Skip to content

Commit

Permalink
Adjust integration test after changing error message
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Jan 21, 2021
1 parent 204640e commit 5ed7b98
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 41 deletions.
9 changes: 8 additions & 1 deletion hack/run-test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function test::integration() {
shout "? go test integration"

# Check if tests passed
if ! go test -v -tags=integration ./tests/integration/...;
# shellcheck disable=SC2046
if ! go test -v -tags=integration ./tests/integration/... $(test::update_golden);
then
echo -e "${RED}✗ go test integration\n${NC}"
exit 1
Expand All @@ -41,6 +42,12 @@ function test::integration() {
fi
}

function test::update_golden() {
if [[ "${UPDATE_GOLDEN:-"false"}" == "true" ]]; then
echo "-update"
fi
}

function main() {
print_info

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
// to the golden file.
//
// To update golden file, run:
// go test ./tests/integration/... -v -update -tags=integration -run=^TestCheckHappyPath$
// UPDATE_GOLDEN=true make test-integration
func TestCheckSuccess(t *testing.T) {
type Envs map[string]string
tests := []struct {
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestCheckSuccess(t *testing.T) {

// then
require.NoError(t, err)
assert.Equal(t, result.ExitCode, 0)
assert.Equal(t, 0, result.ExitCode)
normalizedOutput := normalizeTimeDurations(result.Stdout)

g := goldie.New(t, goldie.WithNameSuffix(".golden.txt"))
Expand All @@ -97,7 +97,7 @@ func TestCheckSuccess(t *testing.T) {
// to the golden file.
//
// To update golden file, run:
// go test ./tests/integration/... -v -update -tags=integration -run=^TestCheckFailures$
// UPDATE_GOLDEN=true make test-integration
func TestCheckFailures(t *testing.T) {
type Envs map[string]string
tests := []struct {
Expand Down
75 changes: 38 additions & 37 deletions tests/integration/testdata/TestCheckFailures/owners.golden.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
==> Executing Valid Owner Checker (<duration>)
[err] line 10: User "@owner-a" does not have github account
[err] line 11: User "@octocat" is not a member of the organization
[err] line 15: Team "amigos" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "avengers" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "bannermen" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "best-of-the-best" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "bosses" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "champions" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "crew" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "dominators" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "dream-team" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "elite" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "force" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "goal-diggers" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "heatwave" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "hot-shots" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "hustle" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "icons" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "justice-league" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "legends" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "lightning" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "masters" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "monarchy" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "naturals" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "outliers" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "peak-performers" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "power" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "rebels" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "revolution" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "ringmasters" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "rule-breakers" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "shakedown" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "squad" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "titans" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "tribe" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "united" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "warriors" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "wolf-pack" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 17: Team "not-existing-team" does not exist in organization "gh-codeowners" or has no permissions associated with the repository.
[err] line 15: Team "avengers" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "bannermen" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "best-of-the-best" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "bosses" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "champions" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "crew" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "dominators" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "dream-team" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "elite" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "force" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "goal-diggers" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "heatwave" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "hot-shots" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "hustle" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "icons" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "justice-league" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "legends" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "lightning" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "masters" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "monarchy" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "naturals" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "ninjas" cannot review PRs on "codeowners-samples" as neither it nor any parent team does not have write permissions.
[err] line 15: Team "outliers" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "peak-performers" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "power" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "rebels" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "revolution" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "ringmasters" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "rule-breakers" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "shakedown" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "squad" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "titans" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "tribe" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "united" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "vikings" cannot review PRs on "codeowners-samples" as neither it nor any parent team does not have write permissions.
[err] line 15: Team "warriors" does not have permissions associated with the repository "codeowners-samples".
[err] line 15: Team "wolf-pack" does not have permissions associated with the repository "codeowners-samples".
[err] line 17: Team "not-existing-team" does not exist in organization "gh-codeowners".

1 check(s) executed, 1 failure(s)

0 comments on commit 5ed7b98

Please sign in to comment.