diff --git a/go.mod b/go.mod index 71c086c51..b69e99426 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99 - golang.org/x/tools v0.1.4 + golang.org/x/tools v0.1.5 google.golang.org/api v0.40.0 google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c google.golang.org/grpc v1.35.0 diff --git a/go.sum b/go.sum index f1ef71f19..a25457c8e 100644 --- a/go.sum +++ b/go.sum @@ -476,6 +476,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/makefile b/makefile index d07f51ea5..e4a61d16a 100644 --- a/makefile +++ b/makefile @@ -34,6 +34,11 @@ clean: @rm -rf ./lib/ @rm -rf ./interfaces/ +# Run the integration tests +test-integration: + @echo Testing membrane plugins + @go run github.com/onsi/ginkgo/ginkgo ./tests/... + # Run all tests test: test-adapters test-membrane test-plugins @echo Done. diff --git a/plugins/kv/dynamodb/dynamo_db_suite_test.go b/plugins/kv/dynamodb/dynamo_db_suite_test.go index 0490a937f..0138e8396 100644 --- a/plugins/kv/dynamodb/dynamo_db_suite_test.go +++ b/plugins/kv/dynamodb/dynamo_db_suite_test.go @@ -23,5 +23,5 @@ import ( func TestDynamoDb(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "DynamoDb Suite") + RunSpecs(t, "DynamoDb KV Suite") } diff --git a/plugins/kv/firestore/firestore_suite_test.go b/plugins/kv/firestore/firestore_suite_test.go index fd6c56704..c5b667998 100644 --- a/plugins/kv/firestore/firestore_suite_test.go +++ b/plugins/kv/firestore/firestore_suite_test.go @@ -23,5 +23,5 @@ import ( func TestFirestore(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Firestore Suite") + RunSpecs(t, "Firestore KV Suite") } diff --git a/plugins/document/boltdb/boltdb_suite_test.go b/tests/plugins/document/boltdb/boltdb_suite_test.go similarity index 100% rename from plugins/document/boltdb/boltdb_suite_test.go rename to tests/plugins/document/boltdb/boltdb_suite_test.go diff --git a/plugins/document/boltdb/boltdb_test.go b/tests/plugins/document/boltdb/boltdb_test.go similarity index 90% rename from plugins/document/boltdb/boltdb_test.go rename to tests/plugins/document/boltdb/boltdb_test.go index 3bce7d724..163cc76f1 100644 --- a/plugins/document/boltdb/boltdb_test.go +++ b/tests/plugins/document/boltdb/boltdb_test.go @@ -19,21 +19,21 @@ import ( ds_plugin "github.com/nitric-dev/membrane/plugins/document/boltdb" test "github.com/nitric-dev/membrane/plugins/document/test" - "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo" ) -var _ = ginkgo.Describe("Bolt", func() { +var _ = Describe("Bolt", func() { docPlugin, err := ds_plugin.New() if err != nil { panic(err) } - ginkgo.BeforeSuite(func() { + BeforeSuite(func() { test.LoadItemsData(docPlugin) }) - ginkgo.AfterSuite(func() { + AfterSuite(func() { err = os.RemoveAll(ds_plugin.DEFAULT_DIR) if err == nil { os.Remove(ds_plugin.DEFAULT_DIR) diff --git a/plugins/document/dynamodb/dynamo_db_suite_test.go b/tests/plugins/document/dynamodb/dynamodb_suite_test.go similarity index 100% rename from plugins/document/dynamodb/dynamo_db_suite_test.go rename to tests/plugins/document/dynamodb/dynamodb_suite_test.go diff --git a/plugins/document/dynamodb/dynamo_db_test.go b/tests/plugins/document/dynamodb/dynamodb_test.go similarity index 95% rename from plugins/document/dynamodb/dynamo_db_test.go rename to tests/plugins/document/dynamodb/dynamodb_test.go index 960382cb7..344e96e18 100644 --- a/plugins/document/dynamodb/dynamo_db_test.go +++ b/tests/plugins/document/dynamodb/dynamodb_test.go @@ -21,7 +21,7 @@ import ( ds_plugin "github.com/nitric-dev/membrane/plugins/document/dynamodb" "github.com/nitric-dev/membrane/plugins/document/test" - "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" @@ -105,8 +105,8 @@ func deleteTable(db *dynamodb.DynamoDB, tableName string) { } } -var _ = ginkgo.Describe("DynamoDb", func() { - defer ginkgo.GinkgoRecover() +var _ = Describe("DynamoDb", func() { + defer GinkgoRecover() os.Setenv("AWS_ACCESS_KEY_ID", "fakeMyKeyId") os.Setenv("AWS_SECRET_ACCESS_KEY", "fakeSecretAccessKey") @@ -118,21 +118,21 @@ var _ = ginkgo.Describe("DynamoDb", func() { // Create DyanmoDB client db := createDynamoClient() - ginkgo.BeforeEach(func() { + BeforeEach(func() { createTable(db, "customers") createTable(db, "users") createTable(db, "items") createTable(db, "parentItems") }) - ginkgo.AfterEach(func() { + AfterEach(func() { deleteTable(db, "customers") deleteTable(db, "users") deleteTable(db, "items") deleteTable(db, "parentItems") }) - ginkgo.AfterSuite(func() { + AfterSuite(func() { stopDynamoProcess(dynaCmd) }) diff --git a/plugins/document/firestore/firestore_suite_test.go b/tests/plugins/document/firestore/firestore_suite_test.go similarity index 100% rename from plugins/document/firestore/firestore_suite_test.go rename to tests/plugins/document/firestore/firestore_suite_test.go diff --git a/plugins/document/firestore/firestore_test.go b/tests/plugins/document/firestore/firestore_test.go similarity index 94% rename from plugins/document/firestore/firestore_test.go rename to tests/plugins/document/firestore/firestore_test.go index c07d9a6d9..22ad7ebc7 100644 --- a/plugins/document/firestore/firestore_test.go +++ b/tests/plugins/document/firestore/firestore_test.go @@ -24,7 +24,7 @@ import ( "cloud.google.com/go/firestore" ds_plugin "github.com/nitric-dev/membrane/plugins/document/firestore" "github.com/nitric-dev/membrane/plugins/document/test" - "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo" ) func startFirestoreProcess() *exec.Cmd { @@ -65,8 +65,8 @@ func createFirestoreClient(ctx context.Context) *firestore.Client { return client } -var _ = ginkgo.Describe("Firestore", func() { - defer ginkgo.GinkgoRecover() +var _ = Describe("Firestore", func() { + defer GinkgoRecover() // Start Firestore Emulator firestoreCmd := startFirestoreProcess() @@ -74,7 +74,7 @@ var _ = ginkgo.Describe("Firestore", func() { ctx := context.Background() db := createFirestoreClient(ctx) - ginkgo.AfterSuite(func() { + AfterSuite(func() { stopFirestoreProcess(firestoreCmd) }) diff --git a/plugins/document/test/service_tests.go b/tests/plugins/document/suite_test.go similarity index 99% rename from plugins/document/test/service_tests.go rename to tests/plugins/document/suite_test.go index 6654ec974..f3abbd814 100644 --- a/plugins/document/test/service_tests.go +++ b/tests/plugins/document/suite_test.go @@ -11,7 +11,8 @@ // 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 test + +package document_test import ( "fmt"