-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsession_key_test.go
58 lines (42 loc) · 1.39 KB
/
session_key_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package v3io
import (
"github.com/nuclio/logger"
"github.com/nuclio/zap"
"github.com/stretchr/testify/suite"
"testing"
)
type SessionKeyTestSuite struct {
suite.Suite
logger logger.Logger
context *Context
session *Session
}
func (suite *SessionKeyTestSuite) SetupTest() {
var err error
suite.logger, err = nucliozap.NewNuclioZapTest("test")
suite.context, err = NewContext(suite.logger, "<CLUSTER_URL>", 1)
suite.Require().NoError(err, "Failed to create context")
sessionConfig := &SessionConfig{
SessionKey: "<SESSION_KEY>",
}
suite.session, err = suite.context.NewSessionFromConfig(sessionConfig)
suite.Require().NoError(err, "Failed to create session")
}
func (suite *SessionKeyTestSuite) TestListAll() {
dummyContext := "context"
responseChan := make(chan *Response, 128)
request, err := suite.session.ListAll(&ListAllInput{}, &dummyContext, responseChan)
suite.Require().NoError(err, "List All returned error")
suite.Require().NotNil(request)
// read a response
response := <-responseChan
// verify there's no error
suite.Require().NoError(response.Error)
output, ok := response.Output.(*ListAllOutput)
suite.Require().True(ok, "Should have been 'ListAllOutput' got %T", response.Output)
suite.Require().True(len(output.Buckets.Bucket) > 0, "Must have at least one bucket")
response.Release()
}
func TestSessionKey(t *testing.T) {
suite.Run(t, new(SessionKeyTestSuite))
}