-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsession_test.go
54 lines (39 loc) · 1.31 KB
/
session_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
package v3io
import (
"github.com/nuclio/logger"
"github.com/nuclio/zap"
"github.com/stretchr/testify/suite"
"testing"
)
type SessionTestSuite struct {
suite.Suite
logger logger.Logger
context *Context
session *Session
}
func (suite *SessionTestSuite) SetupTest() {
var err error
suite.logger, err = nucliozap.NewNuclioZapTest("test")
suite.context, err = NewContext(suite.logger, "<value>", 1)
suite.Require().NoError(err, "Failed to create context")
suite.session, err = suite.context.NewSession("iguazio", "<value>", "")
suite.Require().NoError(err, "Failed to create session")
}
func (suite *SessionTestSuite) 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 TestSession(t *testing.T) {
suite.Run(t, new(SessionTestSuite))
}