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

Adding build tags to each test file #2116

Merged
merged 2 commits into from
Dec 27, 2024
Merged
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
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
15 changes: 6 additions & 9 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 All @@ -24,9 +27,9 @@ import (
"github.com/jackc/pgx/v5"
"github.com/stretchr/testify/assert"
"github.com/testcontainers/testcontainers-go/modules/yugabytedb"

"github.com/yugabyte/yb-voyager/yb-voyager/src/issue"
"github.com/yugabyte/yb-voyager/yb-voyager/src/ybversion"
testutils "github.com/yugabyte/yb-voyager/yb-voyager/test/utils"
)

var (
Expand Down Expand Up @@ -56,15 +59,9 @@ func getConn() (*pgx.Conn, error) {
return conn, nil
}

func fatalIfError(t *testing.T, err error) {
if err != nil {
t.Fatalf("error: %v", err)
}
}

func assertErrorCorrectlyThrownForIssueForYBVersion(t *testing.T, execErr error, expectedError string, issue issue.Issue) {
isFixed, err := issue.IsFixedIn(testYbVersion)
fatalIfError(t, err)
testutils.FatalIfError(t, err)

if isFixed {
assert.NoError(t, execErr)
Expand Down Expand Up @@ -247,7 +244,7 @@ func TestDDLIssuesInYBVersion(t *testing.T) {

ybVersionWithoutBuild := strings.Split(ybVersion, "-")[0]
testYbVersion, err = ybversion.NewYBVersion(ybVersionWithoutBuild)
fatalIfError(t, err)
testutils.FatalIfError(t, err)

testYugabytedbConnStr = os.Getenv("YB_CONN_STR")
if testYugabytedbConnStr == "" {
Expand Down
5 changes: 4 additions & 1 deletion 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 All @@ -23,6 +25,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/testcontainers/testcontainers-go/modules/yugabytedb"
testutils "github.com/yugabyte/yb-voyager/yb-voyager/test/utils"

"github.com/yugabyte/yb-voyager/yb-voyager/src/ybversion"
)
Expand Down Expand Up @@ -123,7 +126,7 @@ func TestDMLIssuesInYBVersion(t *testing.T) {

ybVersionWithoutBuild := strings.Split(ybVersion, "-")[0]
testYbVersion, err = ybversion.NewYBVersion(ybVersionWithoutBuild)
fatalIfError(t, err)
testutils.FatalIfError(t, err)

testYugabytedbConnStr = os.Getenv("YB_CONN_STR")
if testYugabytedbConnStr == "" {
Expand Down
Loading