func TestGroupCreate(t *testing.T) { srv := NewServer(&Config{Store: fake.NewFixedStore()}) _, err := srv.GroupPut(context.Background(), &pb.GroupPutRequest{Group: fake.Group}) // assert that: // - Group creation is successful // - Group can be retrieved by id assert.Nil(t, err) group, err := srv.GroupGet(context.Background(), &pb.GroupGetRequest{Id: fake.Group.Id}) assert.Equal(t, fake.Group, group) assert.Nil(t, err) }
func TestProfileCreate(t *testing.T) { srv := NewServer(&Config{Store: fake.NewFixedStore()}) _, err := srv.ProfilePut(context.Background(), &pb.ProfilePutRequest{Profile: fake.Profile}) // assert that: // - Profile creation is successful // - Profile can be retrieved by id assert.Nil(t, err) profile, err := srv.ProfileGet(context.Background(), &pb.ProfileGetRequest{Id: fake.Profile.Id}) assert.Equal(t, fake.Profile, profile) assert.Nil(t, err) }
func TestIgnitionPut(t *testing.T) { srv := NewServer(&Config{Store: fake.NewFixedStore()}) req := &pb.IgnitionPutRequest{ Name: fake.IgnitionYAMLName, Config: []byte(fake.IgnitionYAML), } _, err := srv.IgnitionPut(context.Background(), req) // assert that: // - Ignition template creation is successful // - Ignition template can be retrieved by name assert.Nil(t, err) template, err := srv.IgnitionGet(context.Background(), fake.IgnitionYAMLName) assert.Equal(t, fake.IgnitionYAML, template) assert.Nil(t, err) }
func TestGroupCreate_Invalid(t *testing.T) { srv := NewServer(&Config{Store: fake.NewFixedStore()}) invalid := &storagepb.Group{} _, err := srv.GroupPut(context.Background(), &pb.GroupPutRequest{Group: invalid}) assert.Error(t, err) }