Skip to content

Config loader tests don't reset the config loader #1049

Closed
@kriswest

Description

@kriswest

After the Config loader tests have run they leave the config loader in a state that could affect further tests, and is adding to the log out making other tests harder to debug.

E.g. here is the tail of a test run, where we're still getting output from the config loader that includes a directory that was created and cleaned up in one of the config loader tests that ran earlier in the sequence:

Starting configuration reload
Found 1 enabled configuration sources
Loading configuration from file source
Loading configuration from file: /Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json
Error loading from file source: ENOENT: no such file or directory, open '/Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json'
No valid configurations loaded from any source
Starting configuration reload
Found 1 enabled configuration sources
Loading configuration from file source
Loading configuration from file: /Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json
Error loading from file source: ENOENT: no such file or directory, open '/Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json'
No valid configurations loaded from any source
      ✔ should fail to login with invalid password (53ms)

  auth
authMethods: [{"type":"local","enabled":true}]
Service Listening on 8080
Starting configuration reload
Found 1 enabled configuration sources
Loading configuration from file source
Loading configuration from file: /Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json
Error loading from file source: ENOENT: no such file or directory, open '/Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json'
No valid configurations loaded from any source
serivce.routes.auth.login: user logged in, username=admin profile={"username":"admin","gitAccount":"none","email":"admin@place.com","admin":true,"_id":"wLRcapNyOkqXMHlu"}
    test push API
      ✔ should get 404 for unknown push

  user creation
authMethods: [{"type":"local","enabled":true}]
Service Listening on 8080
Starting configuration reload
Found 1 enabled configuration sources
Loading configuration from file source
Loading configuration from file: /Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json
Error loading from file source: ENOENT: no such file or directory, open '/Users/kristopher.west/Documents/code/fork-git-proxy/gitproxy-configloader-test-51mwlq/test-config.json'
No valid configurations loaded from any source
serivce.routes.auth.login: user logged in, username=admin profile={"username":"admin","gitAccount":"none","email":"admin@place.com","admin":true,"_id":"wLRcapNyOkqXMHlu"}
    ✔ should be able to login (56ms)
    - should be able to create a new user

I.e. the majority of the output in some tests is from the config loader, which is not relevant to that test.

Expected behaviour
The Config Loader tests should clean up after themselves, restoring the configuration to default/the state it was in at the start of the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions