Skip to content

Commit

Permalink
Adding unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi200123 committed May 17, 2024
1 parent 6ab68c8 commit 2255eaa
Show file tree
Hide file tree
Showing 429 changed files with 11,050 additions and 3,830 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ To this end, this provider supports the following extra specs schema:
},
"enable_boot_debug": {
"type": "boolean",
"description": "Enable cloud-init debug mode. Adds `set -x` into the cloud-init script."
"description": "Enable cloud-init debug mode. Adds 'set -x' into the cloud-init script."
},
"allow_image_owners": {
"allowed_image_owners": {
"type": "array",
"items": {
"type": "string"
},
"description": "A list of image owners to allow when creating the instance. If not specified, all images will be allowed."
}
},
"image_visibility": {
"type": "string",
"description": "The visibility of the image to use."
}
},
"additionalProperties": false
}
Expand Down
10 changes: 9 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ type OpenstackClient struct {
controllerID string
}

func SetOpenstackClient(client *OpenstackClient, compute, image, network, volume *gophercloud.ServiceClient, controllerID string) {
client.compute = compute
client.image = image
client.network = network
client.volume = volume
client.controllerID = controllerID
}

// CreateServerFromImage creates a new server from an image.
func (o *OpenstackClient) CreateServerFromImage(createOpts servers.CreateOpts) (srv ServerWithExt, err error) {
defer func() {
Expand Down Expand Up @@ -450,7 +458,7 @@ func (o *OpenstackClient) StartServer(nameOrID string) error {
}

if err := startstop.Start(o.compute, srv.ID).ExtractErr(); err != nil {
return fmt.Errorf("failed to stop server: %w", err)
return fmt.Errorf("failed to start server: %w", err)
}

return nil
Expand Down
Loading

0 comments on commit 2255eaa

Please sign in to comment.