-
Notifications
You must be signed in to change notification settings - Fork 12
50 run tests requiring a bitbucket server in GitHub actions #52
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
50 run tests requiring a bitbucket server in GitHub actions #52
Conversation
3674a87
to
49d8d26
Compare
Caveat: the workzone and hook tests will not be run, since these require additional plugins installed in Bitbucket. |
@@ -0,0 +1,13 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: #!/bin/sh
suffices here
LocalRepo = "/tmp/bec-test" ++ integer_to_list(rand:uniform(1 bsl 127)), | ||
ok = cmd("mkdir -p ~s && cd ~s && " | ||
"git init . && " | ||
"git config user.email $USER@$HOSTNAME && " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shouldn't these be hard-coded to something innocous like jane.doe@example.com
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but the repo is extremely shortlived (it is deleted in the same shell command). It only exists in order to populate the repository with a branch/commit.
init_repo() | ||
catch C:T:St -> | ||
%% If the setup function fails, the teardown function is not | ||
%% executed and we risk leaving a running bitbucket instance in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: an inconsistent state
|
||
cmd(Fmt, Args) -> | ||
Cmd = lists:flatten(io_lib:format(Fmt, Args)), | ||
%% TODO log command output somewhere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're enabling lager
so why not that?
@@ -423,18 +442,25 @@ setup() -> | |||
application:set_env(bec, bitbucket_username, Username), | |||
application:set_env(bec, bitbucket_password, Password), | |||
{ok, Started} = application:ensure_all_started(bec), | |||
#{started => Started}. | |||
bec_test_utils:init_bitbucket(), | |||
bec_test_utils:init_logging(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if logging shouldn't be enabled first, and perhaps even be baked into init_bitbucket/0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to rip out lager and replace it with logger
to get rid of an unnecessary dependency. I'll take care of this feedback then.
This is a rather large PR which adds support for running the PropEr tests in
prop_api.erl
andprop_yml.erl
. These tests require a running Bitbucket Server instance, which is the reason these have not been run before. This also caused problems because PRs opened against the GitHub repo were not being tested properly. (These tests were only run internally at Klarna.)To spin up a Bitbucket Server instance, the
build.yml
workflow has been modified to start a Bitbucket service using theatlassian/bitbucket-server:7.17.1
Docker image. It uses a "time-bomb" license retrieved from here which will automatically expire after three hours.There is also a docker-compose setup in
scripts/pre-test-hook.sh
which is invoked automatically when runningrebar3 proper
locally. (Currently, to run these tests locally, you must use therun-tests-with-bb.sh
script, but I hope to fix so that won't be necessary, and users should be able to just runrebar3 proper
to test things, and things should "just work".