func TestUpSimple(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) 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 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 TestIpCmd(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) provider.Create(providers.Host{ Name: "test1", IP: "127.0.0.1", }) stdout, stderr := testRunCmd(t, "hostctl ip test1", 0, provider, nil) ensure.DeepEqual(t, stdout.String(), "127.0.0.1\n") ensure.DeepEqual(t, stderr.String(), "") }
func TestListBasic(t *testing.T) { t.Parallel() provider := new(providers.TestProvider) provider.Create(providers.Host{ Name: "test1", }) provider.Create(providers.Host{ Name: "test2", }) stdout, stderr := testRunCmd(t, "hostctl ls", 0, provider, nil) ensure.DeepEqual(t, stdout.String(), "test1\ntest2\n") ensure.DeepEqual(t, stderr.String(), "") }
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)) }