Skip to content

Commit

Permalink
Enable conformance test for memcached state store
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Verst <[email protected]>
  • Loading branch information
berndverst committed Aug 9, 2022
1 parent 5d4727e commit 9d1f7e3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/infrastructure/docker-compose-memcached.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '2'

services:
memcached:
image: docker.io/memcached:1.6
ports:
- '11211:11211'
5 changes: 5 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
- secretstores.localenv
- secretstores.localfile
- state.cassandra
- state.memcached
- state.mongodb
- state.mysql
- state.postgresql
Expand Down Expand Up @@ -237,6 +238,10 @@ jobs:
- name: Start kafka
run: docker-compose -f ./.github/infrastructure/docker-compose-kafka.yml -p kafka up -d
if: contains(matrix.component, 'kafka')

- name: Start memcached
run: docker-compose -f ./.github/infrastructure/docker-compose-memcached.yml -p memcached up -d
if: contains(matrix.component, 'memcached')

- name: Start natsstreaming
run: docker-compose -f ./.github/infrastructure/docker-compose-natsstreaming.yml -p natsstreaming up -d
Expand Down
3 changes: 3 additions & 0 deletions state/memcached/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ func (m *Memcached) setValue(req *state.SetRequest) error {
func (m *Memcached) Delete(req *state.DeleteRequest) error {
err := m.client.Delete(req.Key)
if err != nil {
if err == memcache.ErrCacheMiss {
return nil
}
return err
}

Expand Down
10 changes: 10 additions & 0 deletions tests/config/state/memcached/statestore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.memcached
version: v1
metadata:
- name: hosts
value: "localhost:11211"
3 changes: 3 additions & 0 deletions tests/config/state/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ components:
allOperations: true
- component: mongodb
allOperations: true
- component: memcached
allOperations: false
operations: [ "set", "get", "delete", "bulkset", "bulkdelete" ]
- component: azure.cosmosdb
allOperations: true
- component: azure.blobstorage
Expand Down
3 changes: 3 additions & 0 deletions tests/conformance/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import (
s_azuretablestorage "github.com/dapr/components-contrib/state/azure/tablestorage"
s_cassandra "github.com/dapr/components-contrib/state/cassandra"
s_cockroachdb "github.com/dapr/components-contrib/state/cockroachdb"
s_memcached "github.com/dapr/components-contrib/state/memcached"
s_mongodb "github.com/dapr/components-contrib/state/mongodb"
s_mysql "github.com/dapr/components-contrib/state/mysql"
s_postgresql "github.com/dapr/components-contrib/state/postgresql"
Expand Down Expand Up @@ -431,6 +432,8 @@ func loadStateStore(tc TestComponent) state.Store {
store = s_cassandra.NewCassandraStateStore(testLogger)
case "cockroachdb":
store = s_cockroachdb.New(testLogger)
case "memcached":
store = s_memcached.NewMemCacheStateStore(testLogger)
default:
return nil
}
Expand Down

0 comments on commit 9d1f7e3

Please sign in to comment.