Is it possible to somehow specify the username/hostname with which CI tests are run?

flashmozzg's Avatar

flashmozzg

25 Mar, 2017 11:02 AM

I mean the WIndows user name. It would be nice if it was possible to run some tests using non-ASCII user names and I'm not sure how to do it from inside CI.

  1. 1 Posted by Ilya Finkelshte... on 26 Mar, 2017 01:27 AM

    Ilya Finkelshteyn's Avatar

    Could you please clarify?

    • do you want to run tests as that new user

    or

    • you want to run tests in standard security context but test code itself should use that new user somehow
  2. 2 Posted by flashmozzg on 26 Mar, 2017 02:30 AM

    flashmozzg's Avatar

    Well, ideally, tests need to be run under than "new" user. Whether it's actually a new user or just some trick/hack to make a program think that it is shouldn't matter as long as the result is the same.

  3. 3 Posted by Ilya Finkelshte... on 27 Mar, 2017 08:03 PM

    Ilya Finkelshteyn's Avatar

    Try to set the following:

    test_script:
    - chcp 65001
    - net user <non-ASCII-user-name> <password> /add
    - net localgroup administrators <non-ASCII-user-name> /add
    - psexec \\localhost -u <non-ASCII-user-name> -p <password> -accepteula <full-path-to-test-script>
    

    Note that test itself should be wrapped into script (<full-path-to-test-script>) and full path should be provided because new <non-ASCII-user-name> user has no environment variables which appveyor user has. Also because of this environment variables issue I envision a lot of problems with this test and you will be probably at least needed to updated path environment variable in the beginning of your test script when you see that some file cannot be found during test execution.

    To examine existing paths for appveyor user you can run -ps: $env:path -split ";". To explore build worker folder structure use RDP.

    Ilya.

  4. 4 Posted by flashmozzg on 31 Mar, 2017 09:04 PM

    flashmozzg's Avatar

    Thanks, it seems to work.

  5. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:16 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac