This file contains utilities to help with integration testing GetApiClient returns a "back door" connection to the Octopus Server that integration tests can use to create fixture data, cleanup, etc
(spaceId string)
| 19 | // GetApiClient returns a "back door" connection to the Octopus Server |
| 20 | // that integration tests can use to create fixture data, cleanup, etc |
| 21 | func GetApiClient(spaceId string) (*client.Client, error) { |
| 22 | apiUrl, err := url.Parse(os.Getenv("OCTOPUS_TEST_URL")) |
| 23 | apiKey := os.Getenv("OCTOPUS_TEST_APIKEY") |
| 24 | |
| 25 | if err != nil || apiUrl == nil || apiKey == "" { |
| 26 | fmt.Println("IntegrationTest GetApiClient cannot launch; OCTOPUS_TEST_URL and OCTOPUS_TEST_APIKEY environment variables must be set") |
| 27 | os.Exit(999) |
| 28 | } |
| 29 | |
| 30 | return client.NewClient(nil, apiUrl, apiKey, spaceId) |
| 31 | } |
| 32 | |
| 33 | func GetCliPath() (cliPath string, cliDir string, err error) { |
| 34 | _, fileName, _, ok := runtime.Caller(1) |
no outgoing calls