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

Add blackbox tests for serve command #608

Merged

Conversation

petemounce
Copy link
Collaborator

@petemounce petemounce commented Aug 25, 2020

Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

Added a cross-platform blackbox test for goss serve to give some outside in safety to #606 and incoming output-format-via-http-content-negotiation change.

Also integrated the alpha testing into the Makefile for coherence with the others. I'm not a comfortable make-r, so please critique brutally if I've done things poorly?

Copy link
Member

@aelsabbahy aelsabbahy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just needs to be hooked into CI

@@ -36,6 +36,14 @@ bench:
$(info INFO: Starting build $@)
go test -bench=.

alpha-test-%: release/goss-%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does this get executed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

via ci/build.sh in the if darwin or windows bit.

(Honestly, Makefiles are not a strong suit for me, so I haven't wired there)

Makefile Outdated
$(info INFO: Starting build $@)
./integration-tests/run-tests-alpha.sh $*

test-serve-%: release/goss-%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make test should execute this as part of it's testing, so that it's part of CI.

I was able to test it locally with make test-serve-linux-amd64 and it looks great.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's wired via ci/build.sh - or have I made a mistake?

@petemounce petemounce force-pushed the serve-integration-test-coverage branch from 9983e32 to fadc66a Compare September 10, 2020 23:14
@petemounce
Copy link
Collaborator Author

Looks good, just needs to be hooked into CI

@aelsabbahy I think that it already is via ci/build.sh? Is there something further?

@aelsabbahy
Copy link
Member

I'm fine with build.sh calling one make task, but I don't want build.sh to turn into an orchestration layer of multiple tasks or make calls.

Basically, for local development a user should be able to run make X and get the desired set of steps executed. I'm guessing this should be part of make test-int-all.

@petemounce
Copy link
Collaborator Author

I've had a go, please take a look?

It's complicated by needing to filter to the current OS that is being executed on, so it sounds like test-int-64/32/all need restructuring to make room for the different OS'. make is really not my forte (I'm more familiar with https://bazel.build), I would deeply appreciate a detailed steer?

@aelsabbahy
Copy link
Member

I'll take a look over the weekend. Thanks for making the changes.

If you don't mind can you send me an order list of all the PRs that are ready to go and which order you prefer them merged in (if any).

I haven't used bazel (outside or demoing it), but I love the concepts behind it and nixos for hermetic builds.

if curl --silent "http://127.0.0.1:${open_port}/healthz" | grep 'Count: 2, Failed: 0, Skipped: 0' ; then
echo "passed"
else
echo "failed, exit code $?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to fail? It just echo's out a message and succeeds.

I added a:
ret=$?
exit $ret

but that didn't work because of the trap

maybe:
ret=$?
and a exit "$ret" at the bottom of cleanup?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was supposed to fail. Fixed inside 23ce6f1. Good catch - sorry!

@petemounce petemounce force-pushed the serve-integration-test-coverage branch from 27f7049 to 23ce6f1 Compare September 15, 2020 21:44
@petemounce
Copy link
Collaborator Author

@aelsabbahy I've rebased and also fixed the lack of failure-on-tests-failing.

@aelsabbahy
Copy link
Member

Ci test failure appears related to this change.

I think this PR is really close.. but maybe some intermittent issues?

@petemounce petemounce force-pushed the serve-integration-test-coverage branch from 90770b5 to dffb864 Compare September 18, 2020 21:31
@petemounce
Copy link
Collaborator Author

I've rebased and made no changes that I think could have fixed some problem, but it is green now.

@aelsabbahy
Copy link
Member

Restarted the build 3 times and it was green all three times, so it might be intermittent.

@aelsabbahy aelsabbahy merged commit 409ded6 into goss-org:master Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants