Skip to content

Commit 1af102f

Browse files
Add Redis StateStore Certification Tests (#1763)
* 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]>
1 parent 4322a22 commit 1af102f

File tree

10 files changed

+1727
-0
lines changed

10 files changed

+1727
-0
lines changed

.github/workflows/certification.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
- pubsub.kafka
5656
- pubsub.rabbitmq
5757
- pubsub.mqtt
58+
- state.redis
5859
- bindings.alicloud.dubbo
5960
- bindings.kafka
6061
EOF
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Redis State Store certification testing
2+
3+
This project aims to test the Redis State Store component under various conditions.
4+
5+
## Test plan
6+
7+
## Basic Test for CRUD operations:
8+
1. Able to create and test connection.
9+
2. Able to do set, fetch, update and delete.
10+
3. Negative test to fetch record with key, that is not present.
11+
12+
## Test save or update data with different TTL settings:
13+
1. TTL not expiring
14+
2. TTL not a valid number
15+
3. Provide a TTL of 1 second:
16+
a. Fetch this record just after saving
17+
b. Sleep for 2 seconds
18+
c. Try to fetch again after a gap of 2 seconds, record shouldn't be found
19+
20+
## Component must reconnect when server or network errors are encountered
21+
22+
## Infra test:
23+
1- When redis goes down and then comes back up - client is able to connect
24+
25+
## eTag related:
26+
a. Insert a Key-Value pair, eTag will be 1
27+
b. Update Value v2 for this Key with eTag equal to 1 - new eTag wil be 2.
28+
c. Try to Update v3 for this Key with eTag equal to 4 - value should not get updated.
29+
d. Get and validate eTag for it should be 2 only.
30+
31+
## Transaction related, like Upsert:
32+
Upsert in Multi function, using 3 keys with updating values and TTL for 2 of the keys, down in the order.
33+
34+
## enableTLS set to true & enableTLS not integer:
35+
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.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: statestore
5+
spec:
6+
type: state.redis
7+
metadata:
8+
- name: redisHost
9+
value: localhost:6379
10+
- name: redisPassword
11+
value: ""
12+
- name: initTimeout
13+
value: 5m
14+
- name: timeout
15+
value: 100s
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: statestore
5+
spec:
6+
type: state.redis
7+
ignoreErrors: true
8+
metadata:
9+
- name: redisHost
10+
value: localhost:6379
11+
- name: redisPassword
12+
value: ""
13+
- name: initTimeout
14+
value: 5m
15+
- name: timeout
16+
value: 100s
17+
- name: enableTLS
18+
value: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: statestore
5+
spec:
6+
type: state.redis
7+
ignoreErrors: true
8+
metadata:
9+
- name: redisHost
10+
value: localhost:6379
11+
- name: redisPassword
12+
value: ""
13+
- name: initTimeout
14+
value: 5m
15+
- name: timeout
16+
value: 100s
17+
- name: maxRetries
18+
value: E
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Configuration
3+
metadata:
4+
name: keyvaultconfig
5+
spec:
6+
features:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "3.3"
2+
services:
3+
redis:
4+
image: 'redislabs/redisearch:latest'
5+
ports:
6+
- '6379:6379'
7+
command: redis-server
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
module github.com/dapr/components-contrib/tests/certification/state/redis
2+
3+
go 1.18
4+
5+
require (
6+
github.com/dapr/components-contrib v1.7.1-0.20220602220636-704f4dd7307d
7+
github.com/dapr/components-contrib/tests/certification v0.0.0-20220526162429-d03aeba3e0d6
8+
github.com/dapr/dapr v1.7.4-0.20220603165529-7e7d81477a0d
9+
github.com/dapr/go-sdk v1.4.0
10+
github.com/dapr/kit v0.0.2-0.20210614175626-b9074b64d233
11+
github.com/stretchr/testify v1.7.1
12+
)
13+
14+
require (
15+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
16+
github.com/golang/mock v1.6.0 // indirect
17+
github.com/tylertreat/comcast v1.0.1 // indirect
18+
)
19+
20+
require (
21+
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
22+
contrib.go.opencensus.io/exporter/zipkin v0.1.1 // indirect
23+
github.com/AdhityaRamadhanus/fasthttpcors v0.0.0-20170121111917-d4c07198763a // indirect
24+
github.com/PuerkitoBio/purell v1.1.1 // indirect
25+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
26+
github.com/agrea/ptr v0.0.0-20180711073057-77a518d99b7b // indirect
27+
github.com/andybalholm/brotli v1.0.2 // indirect
28+
github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f // indirect
29+
github.com/armon/go-metrics v0.3.9 // indirect
30+
github.com/beorn7/perks v1.0.1 // indirect
31+
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
32+
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
33+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
34+
github.com/davecgh/go-spew v1.1.1 // indirect
35+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
36+
github.com/fasthttp/router v1.3.8 // indirect
37+
github.com/fatih/color v1.10.0 // indirect
38+
github.com/fsnotify/fsnotify v1.5.4 // indirect
39+
github.com/ghodss/yaml v1.0.0 // indirect
40+
github.com/go-kit/log v0.2.0 // indirect
41+
github.com/go-logfmt/logfmt v0.5.1 // indirect
42+
github.com/go-logr/logr v1.2.3 // indirect
43+
github.com/go-redis/redis/v8 v8.11.5
44+
github.com/gogo/protobuf v1.3.2 // indirect
45+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
46+
github.com/golang/protobuf v1.5.2 // indirect
47+
github.com/google/cel-go v0.9.0 // indirect
48+
github.com/google/go-cmp v0.5.8 // indirect
49+
github.com/google/gofuzz v1.1.0 // indirect
50+
github.com/google/uuid v1.3.0 // indirect
51+
github.com/googleapis/gnostic v0.5.5 // indirect
52+
github.com/grandcat/zeroconf v0.0.0-20190424104450-85eadb44205c // indirect
53+
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
54+
github.com/hashicorp/consul/api v1.11.0 // indirect
55+
github.com/hashicorp/errwrap v1.1.0 // indirect
56+
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
57+
github.com/hashicorp/go-hclog v0.16.2 // indirect
58+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
59+
github.com/hashicorp/go-multierror v1.1.1 // indirect
60+
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
61+
github.com/hashicorp/golang-lru v0.5.4 // indirect
62+
github.com/hashicorp/serf v0.9.5 // indirect
63+
github.com/imdario/mergo v0.3.12 // indirect
64+
github.com/json-iterator/go v1.1.12 // indirect
65+
github.com/klauspost/compress v1.14.4 // indirect
66+
github.com/mattn/go-colorable v0.1.8 // indirect
67+
github.com/mattn/go-isatty v0.0.14 // indirect
68+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
69+
github.com/miekg/dns v1.1.35 // indirect
70+
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
71+
github.com/mitchellh/go-homedir v1.1.0 // indirect
72+
github.com/mitchellh/mapstructure v1.5.0 // indirect
73+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
74+
github.com/modern-go/reflect2 v1.0.2 // indirect
75+
github.com/openzipkin/zipkin-go v0.2.2 // indirect
76+
github.com/pkg/errors v0.9.1 // indirect
77+
github.com/pmezard/go-difflib v1.0.0 // indirect
78+
github.com/prometheus/client_golang v1.12.2 // indirect
79+
github.com/prometheus/client_model v0.2.0 // indirect
80+
github.com/prometheus/common v0.34.0 // indirect
81+
github.com/prometheus/procfs v0.7.3 // indirect
82+
github.com/prometheus/statsd_exporter v0.22.3 // indirect
83+
github.com/savsgio/gotils v0.0.0-20210217112953-d4a072536008 // indirect
84+
github.com/sirupsen/logrus v1.8.1 // indirect
85+
github.com/sony/gobreaker v0.4.2-0.20210216022020-dd874f9dd33b // indirect
86+
github.com/spf13/pflag v1.0.5 // indirect
87+
github.com/stoewer/go-strcase v1.2.0 // indirect
88+
github.com/stretchr/objx v0.3.0 // indirect
89+
github.com/valyala/bytebufferpool v1.0.0 // indirect
90+
github.com/valyala/fasthttp v1.31.1-0.20211216042702-258a4c17b4f4 // indirect
91+
go.opencensus.io v0.23.0 // indirect
92+
go.opentelemetry.io/otel v1.7.0 // indirect
93+
go.uber.org/atomic v1.9.0 // indirect
94+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
95+
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
96+
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
97+
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
98+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
99+
golang.org/x/text v0.3.7 // indirect
100+
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
101+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
102+
google.golang.org/appengine v1.6.7 // indirect
103+
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
104+
google.golang.org/grpc v1.46.2 // indirect
105+
google.golang.org/protobuf v1.28.0 // indirect
106+
gopkg.in/inf.v0 v0.9.1 // indirect
107+
gopkg.in/yaml.v2 v2.4.0 // indirect
108+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
109+
k8s.io/api v0.23.0 // indirect
110+
k8s.io/apiextensions-apiserver v0.23.0 // indirect
111+
k8s.io/apimachinery v0.23.0 // indirect
112+
k8s.io/client-go v0.23.0 // indirect
113+
k8s.io/component-base v0.23.0 // indirect
114+
k8s.io/klog/v2 v2.30.0 // indirect
115+
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
116+
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
117+
sigs.k8s.io/controller-runtime v0.11.0 // indirect
118+
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
119+
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
120+
sigs.k8s.io/yaml v1.3.0 // indirect
121+
)
122+
123+
replace go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.20.0
124+
125+
replace github.com/dapr/components-contrib/tests/certification => ../../
126+
127+
replace github.com/dapr/components-contrib => ../../../../

0 commit comments

Comments
 (0)