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

Test fails due to missing CLI docs destination directory #723

Closed
bephinix opened this issue Sep 29, 2024 · 3 comments · Fixed by #724
Closed

Test fails due to missing CLI docs destination directory #723

bephinix opened this issue Sep 29, 2024 · 3 comments · Fixed by #724
Labels
bug Something isn't working

Comments

@bephinix
Copy link
Contributor

Description
If the directory docs/cli does not exist (e.g. new clone of repository), one test fails as it tries to list files for a directory which does not exist, leading to no such file or directory.

Reproduction Steps
Steps to reproduce the behavior:

  1. Pull clean copy of repository.
  2. Change directory to repository root.
  3. Run make test.
  4. At least one test fails.

What happened
The following output is shown:

go test -race -coverprofile=c.out ./...
go tool cover -html=c.out -o=coverage.html
        github.com/miniscruff/changie           coverage: 0.0% of statements
        github.com/miniscruff/changie/then              coverage: 0.0% of statements
✔ Kind … Changed
✔ Body … older
✔ Kind … Changed
✔ Body … newer
Error: invalid argument "blah-blah-blah" for "changie next"
Usage:
  changie next major|minor|patch|auto [flags]

Flags:
  -h, --help                 help for next
  -i, --include strings      Include extra directories to search for change files, relative to change directory
  -m, --metadata strings     Metadata values to append to version
  -p, --prerelease strings   Prerelease values to append to version
  -j, --project string       Specify which project we are interested in

Error: invalid argument "v1.2.3" for "changie next"
Usage:
  changie next major|minor|patch|auto [flags]

Flags:
  -h, --help                 help for next
  -i, --include strings      Include extra directories to search for change files, relative to change directory
  -m, --metadata strings     Metadata values to append to version
  -p, --prerelease strings   Prerelease values to append to version
  -j, --project string       Specify which project we are interested in

--- FAIL: TestCanGetFiles (0.00s)
    gen_test.go:45: expected 'open docs/cli: no such file or directory' to be nil
                                    ✔ Kind … removed
✔ Body … a message with testcontent
                                    ✔ Kind … removed
✔ Body … a message
                                    ✔ Kind … removed
✖ Body … a message
                                    ✔ Kind … removed
✔ Body … a message
✔ Body … another body
                                    ✔ Component … test/component
                                    ✔ Kind … removed
✔ Body … a message
FAIL
coverage: 82.2% of statements
FAIL    github.com/miniscruff/changie/cmd       3.463s
ok      github.com/miniscruff/changie/core      3.471s  coverage: 97.6% of statements
FAIL

Expected behavior
All tests should succeed.

Additional context
Nothing.

@bephinix
Copy link
Contributor Author

bephinix commented Sep 29, 2024

@miniscruff Additional note: This issue also applies to the source of v1.21.0. Therefore the references MR must be used to patch the sources for package distribution (e.g. AUR).

@miniscruff
Copy link
Owner

I am so confused how this got through CI but you seem to be right so, thanks.

@bephinix
Copy link
Contributor Author

@miniscruff I guess it got through CI due to some caching. If the directory is created once, it is ignored by git and further execution of make test will clear the directory. It might be a good idea to check if there is some kind of caching between CI actions (I am not an expert for GitHub Actions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants