-
Notifications
You must be signed in to change notification settings - Fork 0
/
operator_test.go
43 lines (36 loc) · 1.04 KB
/
operator_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
// Copyright 2019 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package caas_test
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"github.com/juju/juju/caas"
"github.com/juju/juju/testing"
)
type OperatorSuite struct {
testing.BaseSuite
}
var _ = gc.Suite(&OperatorSuite{})
func (s *OperatorSuite) TestOperatorInfo(c *gc.C) {
info := caas.OperatorInfo{
CACert: "ca cert",
Cert: "cert",
PrivateKey: "private key",
}
marshaled, err := info.Marshal()
c.Assert(err, jc.ErrorIsNil)
unmarshaledInfo, err := caas.UnmarshalOperatorInfo(marshaled)
c.Assert(err, jc.ErrorIsNil)
c.Assert(*unmarshaledInfo, jc.DeepEquals, info)
}
func (s *OperatorSuite) TestOperatorClientInfo(c *gc.C) {
info := caas.OperatorClientInfo{
ServiceAddress: "1.2.3.4",
Token: "token",
}
marshaled, err := info.Marshal()
c.Assert(err, jc.ErrorIsNil)
unmarshaledInfo, err := caas.UnmarshalOperatorClientInfo(marshaled)
c.Assert(err, jc.ErrorIsNil)
c.Assert(*unmarshaledInfo, jc.DeepEquals, info)
}