MCPcopy Create free account
hub / github.com/convox/rack / TestProcessRun

Function TestProcessRun

sdk/methods_test.go:806–844  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

804}
805
806func TestProcessRun(t *testing.T) {
807 app := "app1"
808 service := "srv1"
809 ps := &structs.Process{
810 Id: "id1",
811 App: "app",
812 Command: "command",
813 Cpu: 5,
814 Host: "host",
815 Image: "image",
816 Instance: "instance",
817 Memory: 1024,
818 Name: "name",
819 Ports: []string{"5000"},
820 Release: "release",
821 Status: "status",
822 TaskDefinition: "task_definition",
823 }
824
825 s := stdapi.New("api", "api")
826 s.Route("POST", fmt.Sprintf("/apps/%s/services/%s/processes", app, service), func(c *stdapi.Context) error {
827 require.Equal(t, ps.Command, c.Header("command"))
828 require.Equal(t, ps.Image, c.Header("image"))
829 require.Equal(t, strconv.Itoa(int(ps.Memory)), c.Header("memory"))
830 require.Equal(t, ps.Release, c.Header("release"))
831 return c.RenderJSON(ps)
832 })
833
834 testServer(t, s, func(c *sdk.Client) {
835 got, err := c.ProcessRun(app, service, structs.ProcessRunOptions{
836 Command: options.String("command"),
837 Image: options.String("image"),
838 Memory: options.Int(1024),
839 Release: options.String("release"),
840 })
841 require.NoError(t, err)
842 require.Equal(t, ps, got)
843 })
844}
845
846func TestProcessStop(t *testing.T) {
847 app := "app1"

Callers

nothing calls this directly

Calls 4

StringFunction · 0.92
IntFunction · 0.92
testServerFunction · 0.70
ProcessRunMethod · 0.65

Tested by

no test coverage detected