func newServerClient(stdinBytes []byte) (*client.DaemonClient, error) { var stdinStruct struct { ServerURL string `json:"daemon_base_url"` } err := json.Unmarshal(stdinBytes, &stdinStruct) if err != nil { return nil, fmt.Errorf("failed to parse stdin as JSON: %s", err) } if stdinStruct.ServerURL == "" { return nil, errors.New(`"daemon_base_url" field required.`) } return client.New(stdinStruct.ServerURL, http.DefaultClient), nil }
var serverIsAvailable = func() error { return VerifyTCPConnection(address) } Context("ducatid server restarts", func() { var ( upSpec models.CNIAddPayload downSpec models.CNIDelPayload daemonClient *client.DaemonClient ipamResult types.Result ) BeforeEach(func() { Eventually(serverIsAvailable).Should(Succeed()) daemonClient = client.New("http://"+address, http.DefaultClient) By("generating config and creating the request") upSpec = models.CNIAddPayload{ Args: "FOO=BAR;ABC=123", ContainerNamespace: containerNamespace.Name(), InterfaceName: "vx-eth0", Network: models.NetworkPayload{ models.Properties{ AppID: appID, SpaceID: spaceID, }, }, ContainerID: containerID, }