Skip to content

Commit

Permalink
test: Separate out integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjholm committed Jul 14, 2021
1 parent 6f1d74b commit 3e8b763
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
5 changes: 5 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion plugins/kv/dynamodb/dynamo_db_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ import (

func TestDynamoDb(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DynamoDb Suite")
RunSpecs(t, "DynamoDb KV Suite")
}
2 changes: 1 addition & 1 deletion plugins/kv/firestore/firestore_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ import (

func TestFirestore(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Firestore Suite")
RunSpecs(t, "Firestore KV Suite")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand All @@ -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)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -65,16 +65,16 @@ 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()

ctx := context.Background()
db := createFirestoreClient(ctx)

ginkgo.AfterSuite(func() {
AfterSuite(func() {
stopFirestoreProcess(firestoreCmd)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3e8b763

Please sign in to comment.