Skip to content

Commit cfb6bbd

Browse files
authored
Fixing the make test (#5)
1 parent 866dcbb commit cfb6bbd

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ TEST?=$$(go list ./... | grep -v /vendor/ | grep -v teamcity)
33
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
44
BUILD_TAGS?=${TOOL}
55
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
6-
GO_TEST_CMD?=go test -v
6+
TEST_ARGS?=-orgId='$(ORG_ID)' -projectId='$(PROJECT_ID)' -clusterId='$(CLUSTER_ID)' -adminUserAccessKey='$(ADMIN_USER_ACCESS_KEY)' -adminUserSecretKey='$(ADMIN_USER_SECRET_KEY)'
7+
GO_TEST_CMD?=go test -v ${TEST_ARGS}
78

89
# bin generates the releaseable binaries for this plugin
910
bin: fmtcheck

couchbasecapella_test.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ var (
2323

2424
func init() {
2525
flag.StringVar(&apiUrl, "apiUrl", "https://cloudapi.dev.nonprod-project-avengers.com/v4", "The base URL for the Couchbase Capella Cloud API")
26-
flag.StringVar(&orgId, "orgId", "6af08c0a-8cab-4c1c-b257-b521575c16d0", "The organization ID for the Couchbase Capella Cloud API")
27-
flag.StringVar(&projectId, "projectId", "d352361d-8de1-445b-9969-873b6decb63a", "The project ID for the Couchbase Capella Cloud API")
28-
flag.StringVar(&clusterId, "clusterId", "226329e6-a08f-4545-a179-bdd3368f058d", "The cluster ID for the Couchbase Capella Cloud API")
29-
flag.StringVar(&adminUserAccessKey, "adminUserAccessKey", "YsOwvsMeAbY4kuSd3iobv8aFm7iaYW53", "The admin user apiKey for the Couchbase Capella Cloud API")
30-
flag.StringVar(&adminUserSecretKey, "adminUserSecretKey", "J#UFmruj2pZreWNr7kJ8mdziC4u!gN5TON4FZCUzaElSKiJDofd76cLiCtLnSdZn", "The admin user secretKey for the Couchbase Capella Cloud API")
26+
flag.StringVar(&orgId, "orgId", "", "The organization ID for the Couchbase Capella Cloud API")
27+
flag.StringVar(&projectId, "projectId", "", "The project ID for the Couchbase Capella Cloud API")
28+
flag.StringVar(&clusterId, "clusterId", "", "The cluster ID for the Couchbase Capella Cloud API")
29+
flag.StringVar(&adminUserAccessKey, "adminUserAccessKey", "", "The admin user apiKey for the Couchbase Capella Cloud API")
30+
flag.StringVar(&adminUserSecretKey, "adminUserSecretKey", "", "The admin user secretKey for the Couchbase Capella Cloud API")
3131
}
3232

3333
var connectionDetails = map[string]interface{}{
@@ -150,6 +150,27 @@ func revokeUser(t *testing.T, username string) error {
150150

151151
func TestDriver(t *testing.T) {
152152

153+
// Check if the required flags are set
154+
if len(apiUrl) == 0 {
155+
t.Fatal("apiUrl cannot be empty")
156+
}
157+
if len(orgId) == 0 {
158+
t.Fatal("orgId cannot be empty. Set it through the env variable ORG_ID or -orgId flag")
159+
}
160+
if len(projectId) == 0 {
161+
t.Fatal("projectId cannot be empty. Set it through the env variable PROJECT_ID or -projectId flag")
162+
}
163+
if len(clusterId) == 0 {
164+
t.Fatal("clusterId cannot be empty. Set it through the env variable CLUSTER_ID or -clusterId flag")
165+
}
166+
if len(adminUserAccessKey) == 0 {
167+
t.Fatal("adminUserAccessKey cannot be empty. Set it through the env variable ADMIN_USER_ACCESS_KEY or -adminUserAccessKey flag")
168+
}
169+
if len(adminUserSecretKey) == 0 {
170+
t.Fatal("adminUserSecretKey cannot be empty. Set it through the env variable ADMIN_USER_SECRET_KEY or -adminUserSecretKey flag")
171+
}
172+
173+
// Set up the connection details
153174
connectionDetails["cloud_api_base_url"] = apiUrl
154175
connectionDetails["organization_id"] = orgId
155176
connectionDetails["project_id"] = projectId

0 commit comments

Comments
 (0)