func TestDestroyGroup(t *testing.T) { s := mockrest.StartNewWithFile(CommonFolder + "deployid_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") depId, err := c.DestroyGroup("/sites") assert.Nil(t, err, "Error response was not expected") assert.Equal(t, "5ed4c0c5-9ff8-4a6f-a0cd-f57f59a34b43", depId.DeploymentID) }
func TestGetGroup(t *testing.T) { s := mockrest.StartNewWithFile(GroupsFolder + "get_group_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") group, err := c.GetGroup("/sites") assert.Nil(t, err, "Error response was not expected") assert.Equal(t, "/sites", group.GroupID, "Expected /sites identifier") }
func TestHasApplication(t *testing.T) { s := mockrest.StartNewWithFile(AppsFolder + "get_app_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") ok, err := c.HasApplication("/storage/redis-x") assert.Nil(t, err, "Error response was not expected") assert.Equal(t, true, ok) }
func TestListApplications(t *testing.T) { s := mockrest.StartNewWithFile(AppsFolder + "list_apps_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") apps, err := c.ListApplications() assert.Nil(t, err, "Error response was not expected") assert.Equal(t, "/myapp", apps.Apps[0].ID) }
func TestListGroups(t *testing.T) { s := mockrest.StartNewWithFile(GroupsFolder + "list_groups_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") groups, err := c.ListGroups() assert.Nil(t, err, "Error response was not expected") assert.Equal(t, 1, len(groups.Groups), "Expected 1 nested group") assert.Equal(t, 0, len(groups.Apps), "Expected 0 top level apps") }
func TestGetApplication(t *testing.T) { s := mockrest.StartNewWithFile(AppsFolder + "get_app_response.json") defer s.Stop() c := NewMarathonClient(s.URL, "", "") app, err := c.GetApplication("storage/redis-x") assert.Nil(t, err, "Error response was not expected") assert.Equal(t, "/storage/redis-x", app.ID) assert.Equal(t, 1, len(app.Ports)) assert.Equal(t, "redis", app.Container.Docker.Image) assert.Equal(t, "cache", app.Labels["role"]) }