Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests are broken in CI #369

Closed
fnesveda opened this issue Jun 1, 2023 · 0 comments · Fixed by #371
Closed

Tests are broken in CI #369

fnesveda opened this issue Jun 1, 2023 · 0 comments · Fixed by #371
Labels
bug Something isn't working. high priority Do this ASAP! This is for mission-critical work or work that blocks other teams in their work.

Comments

@fnesveda
Copy link
Member

fnesveda commented Jun 1, 2023

There is this check in tests that is supposed to make sure that some tests are not run locally, because it can break a user's environment:

if (fs.existsSync(GLOBAL_CONFIGS_FOLDER)) {
// Skip tests if user used CLI on local, it can break local environment!
console.warn(`Test was skipped as directory ${GLOBAL_CONFIGS_FOLDER} exists!`);
this.skip();
return;
}

But it causes some tests to be skipped in CI as well, because once a test does apify login, no other tests with this check will ever run.

@fnesveda fnesveda added bug Something isn't working. high priority Do this ASAP! This is for mission-critical work or work that blocks other teams in their work. labels Jun 1, 2023
fnesveda added a commit that referenced this issue Jun 6, 2023
The CLI unit tests were not running correctly for a while.

The problem was:
- some tests were configured to be skipped when the `~/.apify` directory
exists (meaing somebody is already logged in with `apify login`)
- but before each command, the `checkLatestVersion` method was called,
which writes the latest version to `~/.apify/state.json`
- this caused all of the tests which checked for `~/.apify` existence to
be skipped

I fixed it so that:
- the `checkLatestVersion` is skipped when the
`APIFY_CLI_SKIP_UPDATE_CHECK` environment variable is set
- the tests are called with `APIFY_CLI_SKIP_UPDATE_CHECK=1`
- the tests actually fail if the `~/.apify` directory exists at their
start (so that we notice these issues immediately next time)
- the `after()` hook is skipped if the `before()` hook throws an error
(this was causing some `chdir`s to be called when they shouldn't be)

Fixing the test execution revealed some errors in the `push` test, so I
fixed those too - I mostly deleted some tests which didn't really make
sense.

I also fixed the tests to clean up the created actors on the platform.

Closes #369.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. high priority Do this ASAP! This is for mission-critical work or work that blocks other teams in their work.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant