func TestScaleUpFromZero(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) stdout, stderr := testRunCmd(t, "hostctl scale test 3", 0, provider, nil) ensure.DeepEqual(t, stderr.String(), "\n") ensure.DeepEqual(t, stdout.String(), "") ensure.NotDeepEqual(t, provider.Get("test.0"), (*providers.Host)(nil)) ensure.NotDeepEqual(t, provider.Get("test.1"), (*providers.Host)(nil)) ensure.NotDeepEqual(t, provider.Get("test.2"), (*providers.Host)(nil)) }
func TestUpMultiple(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) stdout, stderr := testRunCmd(t, "hostctl up test1 test2 test3", 0, provider, nil) ensure.DeepEqual(t, stderr.String(), "\n") ensure.DeepEqual(t, stdout.String(), "") ensure.NotDeepEqual(t, provider.Get("test1"), (*providers.Host)(nil)) ensure.NotDeepEqual(t, provider.Get("test2"), (*providers.Host)(nil)) ensure.NotDeepEqual(t, provider.Get("test3"), (*providers.Host)(nil)) }
func TestNotDeepEqualStruct(t *testing.T) { var c capture v := typ{Answer: 42} ensure.NotDeepEqual(&c, v, v) c.Equal(t, `ensure_test.go:85: expected two different values, but got the same: (ensure_test.typ) { Answer: (int) 42 }`) }
func TestUserAgent(t *testing.T) { t.Parallel() done := make(chan struct{}) c := &parse.Client{ Transport: transportFunc(func(r *http.Request) (*http.Response, error) { defer close(done) ensure.NotDeepEqual(t, r.Header.Get("User-Agent"), "") return nil, errors.New("") }), } c.Do(&http.Request{}, nil, nil) <-done }
func TestUpExists(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) provider.Create(providers.Host{ Name: "test1", }) stdout, stderr := testRunCmd(t, "hostctl up test1", 0, provider, nil) ensure.DeepEqual(t, stderr.String(), "\n") ensure.DeepEqual(t, stdout.String(), "") ensure.NotDeepEqual(t, provider.Get("test1"), (*providers.Host)(nil)) }
func TestScaleDownToOne(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) provider.Create(providers.Host{ Name: "test.0", }) provider.Create(providers.Host{ Name: "test.1", }) provider.Create(providers.Host{ Name: "test.2", }) stdout, stderr := testRunCmd(t, "hostctl scale test 1", 0, provider, nil) ensure.DeepEqual(t, stderr.String(), "\n") ensure.DeepEqual(t, stdout.String(), "") ensure.NotDeepEqual(t, provider.Get("test.0"), (*providers.Host)(nil)) ensure.DeepEqual(t, provider.Get("test.1"), (*providers.Host)(nil)) ensure.DeepEqual(t, provider.Get("test.2"), (*providers.Host)(nil)) }