Skip to content

Commit

Permalink
Add Redis StateStore Certification Tests (#1763)
Browse files Browse the repository at this point in the history
* Add redis certification test

Signed-off-by: Deepanshu Agarwal <[email protected]>

* Adding Test Plan in ReadMe

Signed-off-by: Deepanshu Agarwal <[email protected]>

* Adding redis state cert test to workflow

Signed-off-by: Deepanshu Agarwal <[email protected]>

* Overwrite open telemetry dependency

Signed-off-by: Bernd Verst <[email protected]>

Co-authored-by: Bernd Verst <[email protected]>
  • Loading branch information
DeepanshuA and berndverst authored Jun 8, 2022
1 parent 4322a22 commit 1af102f
Show file tree
Hide file tree
Showing 10 changed files with 1,727 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/certification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
- pubsub.kafka
- pubsub.rabbitmq
- pubsub.mqtt
- state.redis
- bindings.alicloud.dubbo
- bindings.kafka
EOF
Expand Down
35 changes: 35 additions & 0 deletions tests/certification/state/redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Redis State Store certification testing

This project aims to test the Redis 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.

## Test save or update data with different TTL settings:
1. TTL not expiring
2. TTL not a valid number
3. Provide a TTL of 1 second:
a. Fetch this record just after saving
b. Sleep for 2 seconds
c. Try to fetch again after a gap of 2 seconds, record shouldn't be found

## Component must reconnect when server or network errors are encountered

## Infra test:
1- When redis goes down and then comes back up - client is able to connect

## eTag related:
a. Insert a Key-Value pair, eTag will be 1
b. Update Value v2 for this Key with eTag equal to 1 - new eTag wil be 2.
c. Try to Update v3 for this Key with eTag equal to 4 - value should not get updated.
d. Get and validate eTag for it should be 2 only.

## Transaction related, like Upsert:
Upsert in Multi function, using 3 keys with updating values and TTL for 2 of the keys, down in the order.

## enableTLS set to true & enableTLS not integer:
Testing by creating component with ignoreErrors: true and then trying to use it, by trying to save, which should error out as state store never got configured successfully.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: initTimeout
value: 5m
- name: timeout
value: 100s
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
ignoreErrors: true
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: initTimeout
value: 5m
- name: timeout
value: 100s
- name: enableTLS
value: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
ignoreErrors: true
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: initTimeout
value: 5m
- name: timeout
value: 100s
- name: maxRetries
value: E
6 changes: 6 additions & 0 deletions tests/certification/state/redis/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: keyvaultconfig
spec:
features:
7 changes: 7 additions & 0 deletions tests/certification/state/redis/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.3"
services:
redis:
image: 'redislabs/redisearch:latest'
ports:
- '6379:6379'
command: redis-server
127 changes: 127 additions & 0 deletions tests/certification/state/redis/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
module github.com/dapr/components-contrib/tests/certification/state/redis

go 1.18

require (
github.com/dapr/components-contrib v1.7.1-0.20220602220636-704f4dd7307d
github.com/dapr/components-contrib/tests/certification v0.0.0-20220526162429-d03aeba3e0d6
github.com/dapr/dapr v1.7.4-0.20220603165529-7e7d81477a0d
github.com/dapr/go-sdk v1.4.0
github.com/dapr/kit v0.0.2-0.20210614175626-b9074b64d233
github.com/stretchr/testify v1.7.1
)

require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/tylertreat/comcast v1.0.1 // indirect
)

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
contrib.go.opencensus.io/exporter/zipkin v0.1.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.2 // indirect
github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f // indirect
github.com/armon/go-metrics v0.3.9 // 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.1 // 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.10.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-redis/redis/v8 v8.11.5
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/cel-go v0.9.0 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.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/hashicorp/consul/api v1.11.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.16.2 // 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.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.14.4 // indirect
github.com/mattn/go-colorable v0.1.8 // 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.35 // 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.0 // 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.2.2 // 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.34.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.8.1 // 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.3.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.31.1-0.20211216042702-258a4c17b4f4 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // 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
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
google.golang.org/grpc v1.46.2 // 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.0-20210107192922-496545a6307b // 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 go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.20.0

replace github.com/dapr/components-contrib/tests/certification => ../../

replace github.com/dapr/components-contrib => ../../../../
Loading

0 comments on commit 1af102f

Please sign in to comment.