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

Step in Github action workflow to verify each go test files have a build tag assigned to it #2373

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ jobs:
cd yb-voyager
go build -v ./...
- name: Verify Build Tags in Test Files
Copy link
Collaborator

Choose a reason for hiding this comment

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

with the way that our pipelines are at the moment, if there are no tags on a test file, will they not run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@makalaaneesh it will run.
there are two cases for test file:

  1. with tag
  2. without tag

go test -v ./... -tags tag1 executes the test with tag1 and untagged
go test -v ./... -tags tag2 executes the test with tag2 and untagged

so the untagged ones will be unnecessarily executed.
Anyways since we are using tags now, so each file should be categorised to a tag.

run: |
MISSING_TAGS=$(grep -L '//go:build' $(find . -type f -name '*_test.go' | grep -v vendor) || true)
if [[ -n "$MISSING_TAGS" ]]; then
echo "The following test files are missing a build tag: "
echo "$MISSING_TAGS"
echo "Ensure all test files have a build tag. If a new build tag is introduced, make sure to update the workflow to trigger the tests for that build tag."
exit 1
fi
- name: Test
run: |
cd yb-voyager
Expand Down
1 change: 1 addition & 0 deletions yb-voyager/cmd/importDataFileTaskPicker_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build unit
/*
Copyright (c) YugabyteDB, Inc.

Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/query/sqltransformer/transformer_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.

Expand Down