|
@@ -284,6 +284,17 @@ func (d *SwarmDaemon) listServices(c *check.C) []swarm.Service {
|
|
|
return services
|
|
|
}
|
|
|
|
|
|
+func (d *SwarmDaemon) createSecret(c *check.C, secretSpec swarm.SecretSpec) string {
|
|
|
+ status, out, err := d.SockRequest("POST", "/secrets", secretSpec)
|
|
|
+
|
|
|
+ c.Assert(err, checker.IsNil, check.Commentf(string(out)))
|
|
|
+ c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf("output: %q", string(out)))
|
|
|
+
|
|
|
+ var scr types.SecretCreateResponse
|
|
|
+ c.Assert(json.Unmarshal(out, &scr), checker.IsNil)
|
|
|
+ return scr.ID
|
|
|
+}
|
|
|
+
|
|
|
func (d *SwarmDaemon) listSecrets(c *check.C) []swarm.Secret {
|
|
|
status, out, err := d.SockRequest("GET", "/secrets", nil)
|
|
|
c.Assert(err, checker.IsNil, check.Commentf(string(out)))
|
|
@@ -294,6 +305,21 @@ func (d *SwarmDaemon) listSecrets(c *check.C) []swarm.Secret {
|
|
|
return secrets
|
|
|
}
|
|
|
|
|
|
+func (d *SwarmDaemon) getSecret(c *check.C, id string) *swarm.Secret {
|
|
|
+ var secret swarm.Secret
|
|
|
+ status, out, err := d.SockRequest("GET", "/secrets/"+id, nil)
|
|
|
+ c.Assert(err, checker.IsNil, check.Commentf(string(out)))
|
|
|
+ c.Assert(status, checker.Equals, http.StatusOK, check.Commentf("output: %q", string(out)))
|
|
|
+ c.Assert(json.Unmarshal(out, &secret), checker.IsNil)
|
|
|
+ return &secret
|
|
|
+}
|
|
|
+
|
|
|
+func (d *SwarmDaemon) deleteSecret(c *check.C, id string) {
|
|
|
+ status, out, err := d.SockRequest("DELETE", "/secrets/"+id, nil)
|
|
|
+ c.Assert(err, checker.IsNil, check.Commentf(string(out)))
|
|
|
+ c.Assert(status, checker.Equals, http.StatusOK, check.Commentf("output: %q", string(out)))
|
|
|
+}
|
|
|
+
|
|
|
func (d *SwarmDaemon) getSwarm(c *check.C) swarm.Swarm {
|
|
|
var sw swarm.Swarm
|
|
|
status, out, err := d.SockRequest("GET", "/swarm", nil)
|