purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.67k stars 315 forks source link

Ensure make test shell block can pass #622

Closed evrardjp closed 3 years ago

evrardjp commented 3 years ago

Without this patch, TEST_BLOCK="shell" make test will fail in CI, with "no Go files in go/src/github.com/purpleidea/mgmt/bindata".

This is a problem, as it will prevent us to move to github actions.

This should fix it, by creating an empty golang file.

purpleidea commented 3 years ago

This is not a bug-- the issue is that you didn't build the generated files before you ran the tests. To do this run make. This is done automatically in our CI.

evrardjp commented 3 years ago

I ran make test, like the documentation suggests. if I check the Makefile, make test has a dep on build, which should be good enough. Because I ran this in CI, I expected that the make build ran and generated the proper content. Apparently I was wrong, and there is something no streamlined in the way the make runs in CI. Also: why the different code paths?

purpleidea commented 3 years ago

why the different code paths?

I don't know exactly what you're referring to, but if I was to guess, then the point is that you can run either:

1) make test (from CI) 2) make (build) 3) ./test/some_test_name.sh (run one individual test as user)

And any of these will ensure that the necessary deps are built.

If I didn't answer all your questions, please re-ask. I'm heading to bed shortly.

purpleidea commented 3 years ago

./test/some_test_name.sh (run one individual test as user)

Note, you can also auto-complete these with make test-<tab>

evrardjp commented 3 years ago

I will dig into why make test, in CI, didn't generate the proper artifacts.

evrardjp commented 3 years ago

If I didn't answer all your questions, please re-ask. I'm heading to bed shortly.

Hahahaha :) IMO no software is worth cutting bed time. Talk to you another day! :)

frebib commented 3 years ago

fwiw, this could be made a bit clearer using go generate to invoke the generator, or even make so go build can perform all of the compilation in one step