MCPcopy Create free account
hub / github.com/cortexproject/cortex / Test_CAS_ErrorNoRetry

Function Test_CAS_ErrorNoRetry

pkg/ring/kv/dynamodb/client_test.go:30–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func Test_CAS_ErrorNoRetry(t *testing.T) {
31 ddbMock := NewDynamodbClientMock()
32 codecMock := &CodecMock{}
33 descMock := &DescMock{}
34 c := NewClientMock(ddbMock, codecMock, TestLogger{}, prometheus.NewPedanticRegistry(), defaultPullTime, defaultBackoff)
35 expectedErr := errors.Errorf("test")
36
37 ddbMock.On("Query").Return(map[string]dynamodbItem{}, nil).Once()
38 codecMock.On("DecodeMultiKey").Return(descMock, nil).Twice()
39 descMock.On("Clone").Return(descMock).Once()
40
41 err := c.CAS(context.TODO(), key, func(in any) (out any, retry bool, err error) {
42 return nil, false, expectedErr
43 })
44
45 require.Equal(t, err, expectedErr)
46}
47
48func Test_CAS_Backoff(t *testing.T) {
49 testCases := []struct {

Callers

nothing calls this directly

Calls 4

NewDynamodbClientMockFunction · 0.85
NewClientMockFunction · 0.85
CASMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected