Skip to content

Commit

Permalink
Adding build tags to each test file
Browse files Browse the repository at this point in the history
- introduced three tags - unit, integration, issues_integration
- every new test file added should have one of these tags
- any test file wihtout tag will be executed with each tag workflow
  • Loading branch information
sanyamsinghal committed Dec 24, 2024
1 parent 43aaeeb commit d1ed265
Show file tree
Hide file tree
Showing 35 changed files with 268 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Test
run: |
cd yb-voyager
go test -v -skip '^(TestDDLIssuesInYBVersion|TestDMLIssuesInYBVersion)$' ./... -tags '!integration'
go test -v ./... -tags 'unit'
- name: Vet
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
- name: Run Integration Tests
run: |
cd yb-voyager
go test -v -skip '^(TestDDLIssuesInYBVersion|TestDMLIssuesInYBVersion)$' ./... -tags 'integration'
go test -v ./... -tags 'integration'
2 changes: 1 addition & 1 deletion .github/workflows/issue-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- name: Test Issues Against YB Version
run: |
cd yb-voyager
go test -v -run '^(TestDDLIssuesInYBVersion|TestDMLIssuesInYBVersion)$' ./... -tags '!integration'
go test -v ./... -tags 'issues_integration'
2 changes: 2 additions & 0 deletions yb-voyager/cmd/analyzeSchema_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
2 changes: 2 additions & 0 deletions yb-voyager/cmd/assessMigrationBulkCommand_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
17 changes: 17 additions & 0 deletions yb-voyager/cmd/common_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd

import (
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/cmd/exportDataStatus_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd

import (
Expand Down
5 changes: 4 additions & 1 deletion yb-voyager/cmd/exportSchema_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Expand All @@ -17,9 +19,10 @@ limitations under the License.
package cmd

import (
"github.com/stretchr/testify/assert"
"strings"
"testing"

"github.com/stretchr/testify/assert"
)

func TestShardingRecommendations(t *testing.T) {
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/cmd/import_data_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd

import (
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/cmd/live_migration_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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/callhome/diagnostics_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package callhome

import (
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/cp/yugabyted/yugabyted_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build integration

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package yugabyted

import (
Expand Down
18 changes: 18 additions & 0 deletions yb-voyager/src/datafile/descriptor_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package datafile

import (
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/dbzm/status_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package dbzm

import (
Expand Down
3 changes: 2 additions & 1 deletion yb-voyager/src/issue/issue_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Expand All @@ -13,7 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package issue

import (
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/metadb/metadataDB_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package metadb

import (
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/migassessment/assessmentDB_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package migassessment

import (
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/migassessment/sizing_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
17 changes: 17 additions & 0 deletions yb-voyager/src/namereg/namereg_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package namereg

import (
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/query/queryissue/detectors_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
3 changes: 3 additions & 0 deletions yb-voyager/src/query/queryissue/issues_ddl_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//go:build issues_integration

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/query/queryissue/issues_dml_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build issues_integration

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
6 changes: 4 additions & 2 deletions yb-voyager/src/query/queryissue/parser_issue_detector_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 Expand Up @@ -543,7 +545,7 @@ FROM books;`,
`SELECT id, JSON_VALUE(details, '$.title') AS title
FROM books
WHERE JSON_EXISTS(details, '$.price ? (@ > $price)' PASSING 30 AS price);`,
`CREATE MATERIALIZED VIEW public.test_jsonb_view AS
`CREATE MATERIALIZED VIEW public.test_jsonb_view AS
SELECT
id,
data->>'name' AS name,
Expand All @@ -556,7 +558,7 @@ JSON_TABLE(data, '$.skills[*]'
skill TEXT PATH '$'
)
) AS jt;`,
`SELECT JSON_ARRAY($1, 12, TRUE, $2) AS json_array;`,
`SELECT JSON_ARRAY($1, 12, TRUE, $2) AS json_array;`,
}
sqlsWithExpectedIssues := map[string][]QueryIssue{
sqls[0]: []QueryIssue{
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/query/queryparser/traversal_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
17 changes: 17 additions & 0 deletions yb-voyager/src/tgtdb/attr_name_registry_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//go:build unit

/*
Copyright (c) YugabyteDB, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package tgtdb

import (
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/tgtdb/conn_pool_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

/*
Copyright (c) YugabyteDB, Inc.
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/tgtdb/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

/*
Copyright (c) YugabyteDB, Inc.
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/tgtdb/postgres_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

/*
Copyright (c) YugabyteDB, Inc.
Expand Down
2 changes: 2 additions & 0 deletions yb-voyager/src/tgtdb/suites/yugabytedbSuite_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
2 changes: 2 additions & 0 deletions yb-voyager/src/tgtdb/yugabytedb_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build integration

/*
Copyright (c) YugabyteDB, Inc.
Expand Down
Loading

0 comments on commit d1ed265

Please sign in to comment.