func TestEtcdCreateServiceAlreadyExisting(t *testing.T) {
	fakeClient := tools.MakeFakeEtcdClient(t)
	fakeClient.Set("/registry/services/specs/foo", api.EncodeOrDie(api.Service{JSONBase: api.JSONBase{ID: "foo"}}), 0)
	registry := MakeTestEtcdRegistry(fakeClient, []string{"machine"})
	err := registry.CreateService(api.Service{
		JSONBase: api.JSONBase{ID: "foo"},
	})
	if !apiserver.IsAlreadyExists(err) {
		t.Errorf("expected already exists err, got %#v", err)
	}
}
Beispiel #2
0
func TestEtcdCreateControllerAlreadyExisting(t *testing.T) {
	fakeClient := tools.MakeFakeEtcdClient(t)
	fakeClient.Set("/registry/controllers/foo", util.MakeJSONString(api.ReplicationController{JSONBase: api.JSONBase{ID: "foo"}}), 0)

	registry := MakeTestEtcdRegistry(fakeClient, []string{"machine"})
	err := registry.CreateController(api.ReplicationController{
		JSONBase: api.JSONBase{
			ID: "foo",
		},
	})
	if !apiserver.IsAlreadyExists(err) {
		t.Errorf("expected already exists err, got %#v", err)
	}
}
Beispiel #3
0
func TestEtcdCreateControllerAlreadyExisting(t *testing.T) {
	fakeClient := tools.NewFakeEtcdClient(t)
	fakeClient.Set("/registry/controllers/foo", api.EncodeOrDie(api.ReplicationController{JSONBase: api.JSONBase{ID: "foo"}}), 0)

	registry := NewTestEtcdRegistry(fakeClient)
	err := registry.CreateController(api.ReplicationController{
		JSONBase: api.JSONBase{
			ID: "foo",
		},
	})
	if !apiserver.IsAlreadyExists(err) {
		t.Errorf("expected already exists err, got %#v", err)
	}
}