Skip to content

Commit

Permalink
cloudapi: Move Services to an actual struct
Browse files Browse the repository at this point in the history
This removes the need to make anonymous structs in the middle of the
Customizations request.
  • Loading branch information
bcl authored and croissanne committed Oct 13, 2023
1 parent ab56a62 commit e3f162c
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 180 deletions.
14 changes: 4 additions & 10 deletions internal/cloudapi/v2/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
// interface{} is a terrible idea. Work around it...
var rootStr interface{} = "root"

// anonymous structs buried in a data type are almost as bad.
services := struct {
Disabled *[]string `json:"disabled,omitempty"`
Enabled *[]string `json:"enabled,omitempty"`
}{
Disabled: &[]string{"cleanup"},
Enabled: &[]string{"sshd"},
}

// Construct the compose request with customizations
cr = ComposeRequest{Customizations: &Customizations{
Users: &[]User{
Expand Down Expand Up @@ -87,7 +78,10 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
MinSize: 1099511627776,
},
},
Services: &services,
Services: &Services{
Disabled: &[]string{"cleanup"},
Enabled: &[]string{"sshd"},
},
Openscap: &OpenSCAP{ProfileId: "B 263-59"},
CustomRepositories: &[]CustomRepository{
CustomRepository{
Expand Down
Loading

0 comments on commit e3f162c

Please sign in to comment.