MCPcopy
hub / github.com/tsuru/tsuru / TestCreateService

Method TestCreateService

service/service_test.go:47–75  ·  view source on GitHub ↗
(c *check.C)

Source from the content-addressed store, hash-verified

45}
46
47func (s *S) TestCreateService(c *check.C) {
48 endpt := map[string]string{
49 "production": "somehost.com",
50 }
51 service := &Service{
52 Name: "my-service",
53 Username: "test",
54 Endpoint: endpt,
55 OwnerTeams: []string{s.team.Name},
56 Password: "abcde",
57 }
58 err := Create(context.TODO(), *service)
59 c.Assert(err, check.IsNil)
60 se, err := Get(context.TODO(), service.Name)
61 c.Assert(err, check.IsNil)
62 c.Assert(se.Name, check.Equals, service.Name)
63 c.Assert(se.Endpoint["production"], check.Equals, endpt["production"])
64 c.Assert(se.OwnerTeams, check.DeepEquals, []string{s.team.Name})
65 c.Assert(se.IsRestricted, check.Equals, false)
66 c.Assert(se.Username, check.Equals, "test")
67
68 service.Name = "per-cluster-endpoing"
69 service.Endpoint = map[string]string{"my-cluster": "https://my.cluster"}
70 err = Create(context.TODO(), *service)
71 c.Assert(err, check.IsNil)
72 se, err = Get(context.TODO(), service.Name)
73 c.Assert(err, check.IsNil)
74 c.Assert(se.Endpoint["my-cluster"], check.Equals, "https://my.cluster")
75}
76
77func (s *S) TestCreateServiceValidation(c *check.C) {
78 endpt := map[string]string{

Callers

nothing calls this directly

Calls 2

CreateFunction · 0.85
GetFunction · 0.70

Tested by

no test coverage detected