Merge pull request #2040 from yash-nisar/mongodb-tests
This commit is contained in:
commit
ebaa1b5cc5
|
|
@ -42,6 +42,7 @@ jobs:
|
|||
- pubsub.kafka
|
||||
- pubsub.rabbitmq
|
||||
- pubsub.mqtt
|
||||
- state.mongodb
|
||||
- state.redis
|
||||
- state.postgresql
|
||||
- bindings.alicloud.dubbo
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
# MongoDB State Store certification testing
|
||||
|
||||
This project aims to test the MongoDB State Store component under various conditions.
|
||||
|
||||
## Test plan
|
||||
|
||||
## Basic Test for CRUD operations:
|
||||
1. Able to create and test connection.
|
||||
2. Able to do set, fetch, update and delete.
|
||||
3. Negative test to fetch record with key, that is not present.
|
||||
|
||||
## Component must reconnect when server or network errors are encountered
|
||||
|
||||
## Infra test:
|
||||
1. When MongoDB goes down and then comes back up - client is able to connect
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
spec:
|
||||
type: state.mongodb
|
||||
version: v1
|
||||
initTimeout: 5m
|
||||
metadata:
|
||||
- name: host
|
||||
value: "localhost:27017"
|
||||
- name: databaseName
|
||||
value: "admin"
|
||||
- name: params
|
||||
value: "?replicaSet=rs0&directConnection=true"
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
spec:
|
||||
type: state.mongodb
|
||||
version: v1
|
||||
initTimeout: 5m
|
||||
metadata:
|
||||
- name: host
|
||||
value: "localhost:27017"
|
||||
- name: databaseName
|
||||
value: "admin"
|
||||
- name: writeConcern
|
||||
value: "majority"
|
||||
- name: readConcern
|
||||
value: "local"
|
||||
- name: operationTimeout
|
||||
value: "10s"
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: statestore
|
||||
spec:
|
||||
type: state.mongodb
|
||||
version: v1
|
||||
initTimeout: 5m
|
||||
metadata:
|
||||
- name: host
|
||||
value: "localhost:27017"
|
||||
- name: databaseName
|
||||
value: "admin"
|
||||
- name: writeConcern
|
||||
value: "majority"
|
||||
- name: readConcern
|
||||
value: "local"
|
||||
- name: operationTimeout
|
||||
value: "10s"
|
||||
- name: params
|
||||
value: "?replicaSet=rs0&directConnection=true"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: keyvaultconfig
|
||||
spec:
|
||||
features:
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
|
||||
mongo1:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27017:27017
|
||||
volumes:
|
||||
- mongo1:/data/db
|
||||
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0"]
|
||||
|
||||
mongo2:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27018:27017
|
||||
volumes:
|
||||
- mongo2:/data/db
|
||||
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
|
||||
|
||||
mongo3:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27019:27017
|
||||
volumes:
|
||||
- mongo3:/data/db
|
||||
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
|
||||
|
||||
mongosetup:
|
||||
image: mongo
|
||||
links:
|
||||
- mongo1
|
||||
depends_on:
|
||||
- mongo1
|
||||
- mongo2
|
||||
- mongo3
|
||||
volumes:
|
||||
- .:/scripts
|
||||
restart: "no"
|
||||
entrypoint: [ "bash", "/scripts/mongo_setup.sh" ]
|
||||
|
||||
volumes:
|
||||
mongo1:
|
||||
mongo2:
|
||||
mongo3:
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
|
||||
mongo1:
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27017:27017
|
||||
volumes:
|
||||
- mongo1:/data/db
|
||||
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all"]
|
||||
|
||||
volumes:
|
||||
mongo1:
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
module github.com/dapr/components-contrib/tests/certification/state/mongodb
|
||||
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/dapr/components-contrib v1.8.0-rc.6
|
||||
github.com/dapr/components-contrib/tests/certification v0.0.0-20220526162429-d03aeba3e0d6
|
||||
github.com/dapr/dapr v1.8.4-0.20220829184035-996cc622ad0c
|
||||
github.com/dapr/go-sdk v1.4.0
|
||||
github.com/dapr/kit v0.0.2
|
||||
github.com/stretchr/testify v1.8.0
|
||||
)
|
||||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
|
||||
github.com/AdhityaRamadhanus/fasthttpcors v0.0.0-20170121111917-d4c07198763a // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/agrea/ptr v0.0.0-20180711073057-77a518d99b7b // indirect
|
||||
github.com/andybalholm/brotli v1.0.4 // indirect
|
||||
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e // indirect
|
||||
github.com/armon/go-metrics v0.3.10 // indirect
|
||||
github.com/aws/aws-sdk-go v1.43.16 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
||||
github.com/fasthttp/router v1.3.8 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-kit/log v0.2.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/cel-go v0.9.0 // indirect
|
||||
github.com/google/go-cmp v0.5.8 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/gnostic v0.5.5 // indirect
|
||||
github.com/grandcat/zeroconf v0.0.0-20190424104450-85eadb44205c // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
|
||||
github.com/hashicorp/consul/api v1.11.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.2.1 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/serf v0.9.6 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.15.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/miekg/dns v1.1.50 // indirect
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.35.0 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.22.3 // indirect
|
||||
github.com/savsgio/gotils v0.0.0-20210217112953-d4a072536008 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/sony/gobreaker v0.4.2-0.20210216022020-dd874f9dd33b // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stoewer/go-strcase v1.2.0 // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
github.com/tylertreat/comcast v1.0.1 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.34.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.0.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.2 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.mongodb.org/mongo-driver v1.5.1 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.opentelemetry.io/otel v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v0.16.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.0.0-20220630215102-69896b714898 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
|
||||
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
|
||||
golang.org/x/tools v0.1.11 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220622171453-ea41d75dfa0f // indirect
|
||||
google.golang.org/grpc v1.47.0 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.23.0 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.23.0 // indirect
|
||||
k8s.io/apimachinery v0.23.0 // indirect
|
||||
k8s.io/client-go v0.23.0 // indirect
|
||||
k8s.io/component-base v0.23.0 // indirect
|
||||
k8s.io/klog/v2 v2.30.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
|
||||
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
|
||||
sigs.k8s.io/controller-runtime v0.11.0 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
||||
replace github.com/dapr/components-contrib/tests/certification => ../../
|
||||
|
||||
replace github.com/dapr/components-contrib => ../../../../
|
||||
|
||||
replace github.com/dapr/go-sdk => github.com/hunter007/dapr-go-sdk v1.3.1-0.20220709114046-2f2dc4f9a684
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
sleep 5
|
||||
echo SETUP.sh time now: `date +"%T" `
|
||||
mongosh --host mongo1:27017 <<EOF
|
||||
var cfg = {
|
||||
"_id": "rs0",
|
||||
"version": 1,
|
||||
"members": [
|
||||
{
|
||||
"_id": 0,
|
||||
"host": "mongo1:27017",
|
||||
"priority": 2
|
||||
},
|
||||
{
|
||||
"_id": 1,
|
||||
"host": "mongo2:27017",
|
||||
"priority": 0
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"host": "mongo3:27017",
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
};
|
||||
rs.initiate(cfg, { force: true });
|
||||
while (! db.isMaster().ismaster ) { sleep(1000) };
|
||||
db.getMongo().setReadPref('primary');
|
||||
rs.status();
|
||||
EOF
|
||||
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
package mongodb_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dapr/components-contrib/tests/certification/flow/network"
|
||||
"github.com/dapr/go-sdk/client"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/dapr/components-contrib/state"
|
||||
stateMongoDB "github.com/dapr/components-contrib/state/mongodb"
|
||||
"github.com/dapr/components-contrib/tests/certification/embedded"
|
||||
"github.com/dapr/components-contrib/tests/certification/flow"
|
||||
"github.com/dapr/components-contrib/tests/certification/flow/dockercompose"
|
||||
"github.com/dapr/components-contrib/tests/certification/flow/sidecar"
|
||||
stateLoader "github.com/dapr/dapr/pkg/components/state"
|
||||
"github.com/dapr/dapr/pkg/runtime"
|
||||
daprTesting "github.com/dapr/dapr/pkg/testing"
|
||||
"github.com/dapr/kit/logger"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const (
|
||||
sidecarNamePrefix = "mongodb-sidecar-"
|
||||
dockerComposeClusterYAML = "docker-compose-cluster.yml"
|
||||
dockerComposeSingleYAML = "docker-compose-single.yml"
|
||||
stateStoreName = "statestore"
|
||||
certificationTestPrefix = "stable-certification-"
|
||||
)
|
||||
|
||||
func TestMongoDB(t *testing.T) {
|
||||
log := logger.NewLogger("dapr.components")
|
||||
stateStore := stateMongoDB.NewMongoDB(log).(*stateMongoDB.MongoDB)
|
||||
ports, err := daprTesting.GetFreePorts(2)
|
||||
assert.NoError(t, err)
|
||||
|
||||
stateRegistry := stateLoader.NewRegistry()
|
||||
stateRegistry.Logger = log
|
||||
stateRegistry.RegisterComponent(func(l logger.Logger) state.Store {
|
||||
return stateStore
|
||||
}, "mongodb")
|
||||
|
||||
// var rdb redis.Client
|
||||
currentGrpcPort := ports[0]
|
||||
currentHTTPPort := ports[1]
|
||||
|
||||
basicTest := func(ctx flow.Context) error {
|
||||
client, err := client.NewClientWithPort(fmt.Sprint(currentGrpcPort))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
err = client.SaveState(ctx, stateStoreName, certificationTestPrefix+"key1", []byte("mongodbCert"), nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = client.SaveState(ctx, stateStoreName, certificationTestPrefix+"key2", []byte("mongodbCert2"), nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// get state
|
||||
item, err := client.GetState(ctx, stateStoreName, certificationTestPrefix+"key1", nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "mongodbCert", string(item.Value))
|
||||
|
||||
errUpdate := client.SaveState(ctx, stateStoreName, certificationTestPrefix+"key1", []byte("mongodbCertUpdate"), nil)
|
||||
assert.NoError(t, errUpdate)
|
||||
item, errUpdatedGet := client.GetState(ctx, stateStoreName, certificationTestPrefix+"key1", nil)
|
||||
assert.NoError(t, errUpdatedGet)
|
||||
assert.Equal(t, "mongodbCertUpdate", string(item.Value))
|
||||
|
||||
// delete state
|
||||
err = client.DeleteState(ctx, stateStoreName, certificationTestPrefix+"key1", nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
testGetAfterMongoDBRestart := func(ctx flow.Context) error {
|
||||
client, err := client.NewClientWithPort(fmt.Sprint(currentGrpcPort))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
// get state
|
||||
item, err := client.GetState(ctx, stateStoreName, certificationTestPrefix+"key2", nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "mongodbCert2", string(item.Value))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
flow.New(t, "Connecting MongoDB And Verifying majority of the tests for a replica set here").
|
||||
Step(dockercompose.Run("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step(sidecar.Run(sidecarNamePrefix+"dockerClusterDefault",
|
||||
embedded.WithoutApp(),
|
||||
embedded.WithDaprGRPCPort(currentGrpcPort),
|
||||
embedded.WithDaprHTTPPort(currentHTTPPort),
|
||||
embedded.WithComponentsPath("components/docker/default"),
|
||||
runtime.WithStates(stateRegistry))).
|
||||
Step("Waiting for component to load...", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test", basicTest).
|
||||
Step("Interrupt network",
|
||||
network.InterruptNetwork(5*time.Second, nil, nil, "27017:27017")).
|
||||
// Component should recover at this point.
|
||||
Step("Wait", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test again to verify reconnection occurred", basicTest).
|
||||
Step("Stop MongoDB server", dockercompose.Stop("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Start MongoDB server", dockercompose.Start("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step("Get Values Saved Earlier And Not Expired, after MongoDB restart", testGetAfterMongoDBRestart).
|
||||
Run()
|
||||
|
||||
flow.New(t, "Connecting MongoDB And Verifying majority of the tests for a replica set "+
|
||||
"here with valid read, write concerns and operation timeout").
|
||||
Step(dockercompose.Run("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step(sidecar.Run(sidecarNamePrefix+"dockerClusterValidReadWriteConcernAndTimeout",
|
||||
embedded.WithoutApp(),
|
||||
embedded.WithDaprGRPCPort(currentGrpcPort),
|
||||
embedded.WithDaprHTTPPort(currentHTTPPort),
|
||||
embedded.WithComponentsPath("components/docker/validReadWriteConcernAndTimeout"),
|
||||
runtime.WithStates(stateRegistry))).
|
||||
Step("Waiting for component to load...", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test", basicTest).
|
||||
Step("Interrupt network",
|
||||
network.InterruptNetwork(5*time.Second, nil, nil, "27017:27017")).
|
||||
// Component should recover at this point.
|
||||
Step("Wait", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test again to verify reconnection occurred", basicTest).
|
||||
Step("Stop MongoDB server", dockercompose.Stop("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Start MongoDB server", dockercompose.Start("mongodb", dockerComposeClusterYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step("Get Values Saved Earlier And Not Expired, after MongoDB restart", testGetAfterMongoDBRestart).
|
||||
Run()
|
||||
|
||||
flow.New(t, "Connecting MongoDB And Verifying majority of the tests here for a single node with valid read, "+
|
||||
"write concerns and operation timeout").
|
||||
Step(dockercompose.Run("mongodb", dockerComposeSingleYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step(sidecar.Run(sidecarNamePrefix+"dockerSingleNode",
|
||||
embedded.WithoutApp(),
|
||||
embedded.WithDaprGRPCPort(currentGrpcPort),
|
||||
embedded.WithDaprHTTPPort(currentHTTPPort),
|
||||
embedded.WithComponentsPath("components/docker/singleNode"),
|
||||
runtime.WithStates(stateRegistry))).
|
||||
Step("Waiting for component to load...", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test", basicTest).
|
||||
Step("Interrupt network",
|
||||
network.InterruptNetwork(5*time.Second, nil, nil, "27017:27017")).
|
||||
// Component should recover at this point.
|
||||
Step("Wait", flow.Sleep(10*time.Second)).
|
||||
Step("Run basic test again to verify reconnection occurred", basicTest).
|
||||
Step("Stop MongoDB server", dockercompose.Stop("mongodb", dockerComposeSingleYAML)).
|
||||
Step("Start MongoDB server", dockercompose.Start("mongodb", dockerComposeSingleYAML)).
|
||||
Step("Waiting for component to start...", flow.Sleep(10*time.Second)).
|
||||
Step("Get Values Saved Earlier And Not Expired, after MongoDB restart", testGetAfterMongoDBRestart).
|
||||
Run()
|
||||
}
|
||||
Loading…
Reference in New Issue