1
1
#! /usr/bin/env bats
2
2
3
+ EXAMPLE_REPO_COMMIT=6cbf0c4fed8f2f48ff1bbd0b537a14b6832eee0f
4
+ EXAMPLE_REPO_TOKEN=a329b944-6856-4bd0-8a16-2b4a96baf76b
5
+
3
6
setup () {
4
7
load ' test_helper/bats-support/load'
5
8
load ' test_helper/bats-assert/load'
@@ -11,42 +14,42 @@ setup() {
11
14
PATH=" $DIR /../hooks:$PATH "
12
15
}
13
16
14
- # @test "Uploads a single report" {
15
- # # Mock the environment for when we're running tests outside of buildkite
16
- # export BUILDKITE_LABEL=${BUILDKITE_LABEL:-bats}
17
- # export BUILDKITE_COMMIT=${BUILDKITE_COMMIT:-$(git rev-parse --verify HEAD)}
18
- # export BUILDKITE_PLUGINS=''
17
+ @test " Uploads a single report" {
18
+ # Mock the environment for when we're running tests outside of buildkite
19
+ export BUILDKITE_LABEL=${BUILDKITE_LABEL:- bats}
20
+ export BUILDKITE_COMMIT=$EXAMPLE_REPO_COMMIT
21
+ export BUILDKITE_PLUGINS=' '
19
22
20
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL='BATS: Single Report Upload'
21
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_TOKEN=42bbb14a-ef66-4e88-8bdb-1507d6e7adc0
22
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_REPORT="$DIR/success.xml"
23
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL=' BATS: Single Report Upload'
24
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_TOKEN=$EXAMPLE_REPO_TOKEN
25
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_REPORT=" $DIR /success.xml"
23
26
24
- # run "post-command"
27
+ run " post-command"
25
28
26
- # assert_success
27
- # assert_output --partial 'Uploaded reports to Check Run Reporter'
28
- # }
29
+ assert_success
30
+ assert_output --partial ' Uploaded reports to Check Run Reporter'
31
+ }
29
32
30
- # @test "Uploads a glob of reports" {
31
- # # Mock the environment for when we're running tests outside of buildkite
32
- # export BUILDKITE_LABEL=${BUILDKITE_LABEL:-bats}
33
- # export BUILDKITE_COMMIT=${BUILDKITE_COMMIT:-$(git rev-parse --verify HEAD)}
34
- # export BUILDKITE_PLUGINS=''
33
+ @test " Uploads a glob of reports" {
34
+ # Mock the environment for when we're running tests outside of buildkite
35
+ export BUILDKITE_LABEL=${BUILDKITE_LABEL:- bats}
36
+ export BUILDKITE_COMMIT=$EXAMPLE_REPO_COMMIT
37
+ export BUILDKITE_PLUGINS=' '
35
38
36
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL='BATS: Multi Report Upload'
37
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_TOKEN=42bbb14a-ef66-4e88-8bdb-1507d6e7adc0
38
- # export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_REPORT="$DIR/**/*.xml"
39
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL=' BATS: Multi Report Upload'
40
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_TOKEN=$EXAMPLE_REPO_TOKEN
41
+ export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_REPORT=" $DIR /**/*.xml"
39
42
40
- # run "post-command"
43
+ run " post-command"
41
44
42
- # assert_success
43
- # assert_output --partial 'Uploaded reports to Check Run Reporter'
44
- # }
45
+ assert_success
46
+ assert_output --partial ' Uploaded reports to Check Run Reporter'
47
+ }
45
48
46
49
@test " Reports API errors" {
47
50
# Mock the environment for when we're running tests outside of buildkite
48
51
export BUILDKITE_LABEL=${BUILDKITE_LABEL:- bats}
49
- export BUILDKITE_COMMIT=' ${BUILDKITE_COMMIT:-$(git rev-parse --verify HEAD)} '
52
+ export BUILDKITE_COMMIT=' $EXAMPLE_REPO_COMMIT '
50
53
export BUILDKITE_PLUGINS=' '
51
54
52
55
export BUILDKITE_PLUGIN_CHECK_RUN_REPORTER_LABEL=' BATS: Single Report Upload'
@@ -56,4 +59,6 @@ setup() {
56
59
run " post-command"
57
60
58
61
assert_failure
62
+ assert_output --partial ' code: 401'
63
+ assert_output --partial ' Could not find repo token in Authorization header'
59
64
}
0 commit comments