Skip to content

Commit

Permalink
GOCBC-826: Add the ability to test only certain features
Browse files Browse the repository at this point in the history
Motivation
----------
It would be useful if we could disable testing against certain
features from the cli.

Changes
-------
Add the ability to set features to be enabled/disabled on the cli.
Add the ability to set flags via env variables.

Change-Id: I01a8f6a0fb663bb1212a2cf47747a784cb9def27
Reviewed-on: http://review.couchbase.org/123640
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Charles Dixon <chvckd@gmail.com>
  • Loading branch information
chvck committed Mar 12, 2020
1 parent daeb450 commit e51d9ec
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 184 deletions.
4 changes: 1 addition & 3 deletions bucket_collectionsmgr_test.go
Expand Up @@ -5,9 +5,7 @@ import (
)

func (suite *IntegrationTestSuite) TestCollectionManagerCrud() {
if !globalCluster.SupportsFeature(CollectionsFeature) {
suite.T().Skip("Skipping test as collections not supported")
}
suite.skipIfUnsupported(CollectionsFeature)

mgr := globalBucket.Collections()

Expand Down
8 changes: 2 additions & 6 deletions bucket_viewindexes_test.go
Expand Up @@ -10,12 +10,8 @@ import (
)

func (suite *IntegrationTestSuite) TestViewIndexManagerCrud() {
if !globalCluster.SupportsFeature(ViewFeature) {
suite.T().Skip("Skipping test as view indexes not supported")
}
if !globalCluster.SupportsFeature(ViewIndexUpsertBugFeature) {
suite.T().Skip("Skipping test due to upsert view indexes bug")
}
suite.skipIfUnsupported(ViewFeature)
suite.skipIfUnsupported(ViewIndexUpsertBugFeature)

mgr := globalBucket.ViewIndexes()

Expand Down
4 changes: 1 addition & 3 deletions bucket_viewquery_test.go
Expand Up @@ -9,9 +9,7 @@ import (
)

func (suite *IntegrationTestSuite) TestViewQuery() {
if !globalCluster.SupportsFeature(ViewIndexUpsertBugFeature) {
suite.T().Skip("Skipping test due to server side bug")
}
suite.skipIfUnsupported(ViewIndexUpsertBugFeature)

n := suite.setupViews()
suite.runViewsTest(n)
Expand Down
4 changes: 1 addition & 3 deletions cluster_analyticsindexes_test.go
Expand Up @@ -5,9 +5,7 @@ import (
)

func (suite *IntegrationTestSuite) TestAnalyticsIndexesCrud() {
if !globalCluster.SupportsFeature(AnalyticsIndexFeature) {
suite.T().Skip("Skipping test, analytics indexes not supported.")
}
suite.skipIfUnsupported(AnalyticsIndexFeature)

mgr := globalCluster.AnalyticsIndexes()

Expand Down
4 changes: 1 addition & 3 deletions cluster_analyticsquery_test.go
Expand Up @@ -17,9 +17,7 @@ type testAnalyticsDataset struct {
}

func (suite *IntegrationTestSuite) TestAnalyticsQuery() {
if globalCluster.NotSupportsFeature(AnalyticsFeature) {
suite.T().Skip("Skipping test as analytics not supported.")
}
suite.skipIfUnsupported(AnalyticsFeature)

n := suite.setupAnalytics()
suite.runAnalyticsTest(n)
Expand Down
12 changes: 3 additions & 9 deletions cluster_bucketmgr_test.go
Expand Up @@ -8,9 +8,7 @@ import (
)

func (suite *IntegrationTestSuite) TestBucketMgrOps() {
if globalCluster.NotSupportsFeature(BucketMgrFeature) {
suite.T().Skip("Skipping test as bucket manager not supported.")
}
suite.skipIfUnsupported(BucketMgrFeature)

mgr := globalCluster.Buckets()

Expand Down Expand Up @@ -96,9 +94,7 @@ func (suite *IntegrationTestSuite) TestBucketMgrOps() {
}

func (suite *IntegrationTestSuite) TestBucketMgrFlushDisabled() {
if globalCluster.NotSupportsFeature(BucketMgrFeature) {
suite.T().Skip("Skipping test as bucket manager not supported.")
}
suite.skipIfUnsupported(BucketMgrFeature)

mgr := globalCluster.Buckets()

Expand Down Expand Up @@ -157,9 +153,7 @@ func (suite *IntegrationTestSuite) TestBucketMgrFlushDisabled() {
}
}
func (suite *IntegrationTestSuite) TestBucketMgrBucketNotExist() {
if globalCluster.NotSupportsFeature(BucketMgrFeature) {
suite.T().Skip("Skipping test as bucket manager not supported.")
}
suite.skipIfUnsupported(BucketMgrFeature)

mgr := globalCluster.Buckets()

Expand Down
5 changes: 2 additions & 3 deletions cluster_ping_test.go
Expand Up @@ -11,9 +11,8 @@ import (
)

func (suite *IntegrationTestSuite) TestClusterPingAll() {
if !globalCluster.SupportsFeature(PingFeature) {
suite.T().Skip("Skipping test as ping not supported")
}
suite.skipIfUnsupported(PingFeature)

report, err := globalCluster.Ping(nil)
suite.Require().Nil(err)

Expand Down
4 changes: 1 addition & 3 deletions cluster_query_test.go
Expand Up @@ -17,9 +17,7 @@ type testQueryDataset struct {
}

func (suite *IntegrationTestSuite) TestQuery() {
if globalCluster.NotSupportsFeature(QueryFeature) {
suite.T().Skip("Skipping test as query not supported.")
}
suite.skipIfUnsupported(QueryFeature)

n := suite.setupQuery()
suite.runQueryTest(n)
Expand Down
4 changes: 1 addition & 3 deletions cluster_queryindexes_test.go
Expand Up @@ -6,9 +6,7 @@ import (
)

func (suite *IntegrationTestSuite) TestQueryIndexesCrud() {
if !globalCluster.SupportsFeature(QueryFeature) {
suite.T().Skip("Skipping test, query indexes not supported.")
}
suite.skipIfUnsupported(QueryFeature)

bucketMgr := globalCluster.Buckets()
bucketName := "testIndexes"
Expand Down
20 changes: 5 additions & 15 deletions cluster_searchindexes_test.go
Expand Up @@ -11,9 +11,7 @@ import (
)

func (suite *IntegrationTestSuite) TestSearchIndexesCrud() {
if !globalCluster.SupportsFeature(SearchIndexFeature) {
suite.T().Skip("Skipping test as search indexes not supported")
}
suite.skipIfUnsupported(SearchIndexFeature)

mgr := globalCluster.SearchIndexes()

Expand Down Expand Up @@ -131,9 +129,7 @@ func (suite *IntegrationTestSuite) TestSearchIndexesCrud() {
}

func (suite *IntegrationTestSuite) TestSearchIndexesUpsertIndexNoName() {
if !globalCluster.SupportsFeature(SearchIndexFeature) {
suite.T().Skip("Skipping test as search indexes not supported")
}
suite.skipIfUnsupported(SearchIndexFeature)

mgr := globalCluster.SearchIndexes()

Expand All @@ -148,9 +144,7 @@ func (suite *IntegrationTestSuite) TestSearchIndexesUpsertIndexNoName() {
}

func (suite *IntegrationTestSuite) TestSearchIndexesIngestControl() {
if !globalCluster.SupportsFeature(SearchIndexFeature) {
suite.T().Skip("Skipping test as search indexes not supported")
}
suite.skipIfUnsupported(SearchIndexFeature)

mgr := globalCluster.SearchIndexes()

Expand Down Expand Up @@ -178,9 +172,7 @@ func (suite *IntegrationTestSuite) TestSearchIndexesIngestControl() {
}

func (suite *IntegrationTestSuite) TestSearchIndexesQueryControl() {
if !globalCluster.SupportsFeature(SearchIndexFeature) {
suite.T().Skip("Skipping test as search indexes not supported")
}
suite.skipIfUnsupported(SearchIndexFeature)

mgr := globalCluster.SearchIndexes()

Expand Down Expand Up @@ -208,9 +200,7 @@ func (suite *IntegrationTestSuite) TestSearchIndexesQueryControl() {
}

func (suite *IntegrationTestSuite) TestSearchIndexesPartitionControl() {
if !globalCluster.SupportsFeature(SearchIndexFeature) {
suite.T().Skip("Skipping test as search indexes not supported")
}
suite.skipIfUnsupported(SearchIndexFeature)

mgr := globalCluster.SearchIndexes()

Expand Down
4 changes: 1 addition & 3 deletions cluster_searchquery_test.go
Expand Up @@ -11,9 +11,7 @@ import (
)

func (suite *IntegrationTestSuite) TestSearch() {
if globalCluster.NotSupportsFeature(SearchFeature) {
suite.T().Skip("Skipping test as search not supported.")
}
suite.skipIfUnsupported(SearchFeature)

n := suite.setupSearch()
suite.runSearchTest(n)
Expand Down
16 changes: 4 additions & 12 deletions cluster_usermgr_test.go
Expand Up @@ -13,9 +13,7 @@ import (
)

func (suite *IntegrationTestSuite) TestUserManagerGroupCrud() {
if !globalCluster.SupportsFeature(UserGroupFeature) {
suite.T().Skip("Skipping test as groups not supported.")
}
suite.skipIfUnsupported(UserGroupFeature)

mgr := globalCluster.Users()

Expand Down Expand Up @@ -83,9 +81,7 @@ func (suite *IntegrationTestSuite) TestUserManagerGroupCrud() {
}

func (suite *IntegrationTestSuite) TestUserManagerWithGroupsCrud() {
if !globalCluster.SupportsFeature(UserGroupFeature) {
suite.T().Skip("Skipping test as groups not supported.")
}
suite.skipIfUnsupported(UserGroupFeature)

mgr := globalCluster.Users()

Expand Down Expand Up @@ -206,9 +202,7 @@ func (suite *IntegrationTestSuite) TestUserManagerWithGroupsCrud() {
}

func (suite *IntegrationTestSuite) TestUserManagerCrud() {
if !globalCluster.SupportsFeature(UserManagerFeature) {
suite.T().Skip("Skipping test as rbac not supported.")
}
suite.skipIfUnsupported(UserManagerFeature)

mgr := globalCluster.Users()

Expand Down Expand Up @@ -281,9 +275,7 @@ func (suite *IntegrationTestSuite) TestUserManagerCrud() {
}

func (suite *IntegrationTestSuite) TestUserManagerAvailableRoles() {
if !globalCluster.SupportsFeature(UserManagerFeature) {
suite.T().Skip("Skipping test as rbac not supported.")
}
suite.skipIfUnsupported(UserManagerFeature)

mgr := globalCluster.Users()

Expand Down
15 changes: 9 additions & 6 deletions collection_binary_crud_test.go
@@ -1,9 +1,8 @@
package gocb

func (suite *IntegrationTestSuite) TestBinaryAppend() {
if !globalCluster.SupportsFeature(AdjoinFeature) {
suite.T().Skip("Skipping due to serverside bug")
}
suite.skipIfUnsupported(KeyValueFeature)
suite.skipIfUnsupported(AdjoinFeature)
colBinary := globalCollection.Binary()

tcoder := NewRawBinaryTranscoder()
Expand Down Expand Up @@ -46,9 +45,9 @@ func (suite *IntegrationTestSuite) TestBinaryAppend() {
}

func (suite *IntegrationTestSuite) TestBinaryPrepend() {
if !globalCluster.SupportsFeature(AdjoinFeature) {
suite.T().Skip("Skipping due to serverside bug")
}
suite.skipIfUnsupported(KeyValueFeature)
suite.skipIfUnsupported(AdjoinFeature)

colBinary := globalCollection.Binary()

tcoder := NewRawBinaryTranscoder()
Expand Down Expand Up @@ -91,6 +90,8 @@ func (suite *IntegrationTestSuite) TestBinaryPrepend() {
}

func (suite *IntegrationTestSuite) TestBinaryIncrement() {
suite.skipIfUnsupported(KeyValueFeature)

colBinary := globalCollection.Binary()

res, err := colBinary.Increment("binaryIncrement", &IncrementOptions{
Expand Down Expand Up @@ -155,6 +156,8 @@ func (suite *IntegrationTestSuite) TestBinaryIncrement() {
}

func (suite *IntegrationTestSuite) TestBinaryDecrement() {
suite.skipIfUnsupported(KeyValueFeature)

colBinary := globalCollection.Binary()

res, err := colBinary.Decrement("binaryDecrement", &DecrementOptions{
Expand Down
2 changes: 2 additions & 0 deletions collection_bulk_test.go
Expand Up @@ -5,6 +5,8 @@ import (
)

func (suite *IntegrationTestSuite) TestUpsertGetBulk() {
suite.skipIfUnsupported(KeyValueFeature)

var ops []BulkOp
for i := 0; i < 20; i++ {
ops = append(ops, &UpsertOp{
Expand Down

0 comments on commit e51d9ec

Please sign in to comment.