octopus-serverspec-extensions 0.15.5 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/docs/authentication.md +45 -0
  3. data/docs/octopus_deploy_account.md +37 -0
  4. data/docs/octopus_deploy_doc_template.md +17 -0
  5. data/docs/octopus_deploy_environment.md +33 -0
  6. data/docs/octopus_deploy_project_group.md +31 -0
  7. data/docs/octopus_deploy_smtp_config.md +39 -0
  8. data/docs/octopus_deploy_space.md +32 -0
  9. data/docs/octopus_deploy_team.md +26 -0
  10. data/docs/octopus_deploy_tentacle.md +41 -0
  11. data/docs/octopus_deploy_upgrade_config.md +34 -0
  12. data/docs/octopus_deploy_user.md +34 -0
  13. data/docs/octopus_deploy_worker.md +39 -0
  14. data/docs/octopus_deploy_worker_pool.md +26 -0
  15. data/lib/octopus_serverspec_extensions.rb +70 -0
  16. data/lib/octopus_serverspec_extensions/matcher/allow_dynamic_infrastructure.rb +13 -0
  17. data/lib/octopus_serverspec_extensions/matcher/use_guided_failure.rb +13 -0
  18. data/lib/octopus_serverspec_extensions/type/octopus_deploy_account.rb +72 -61
  19. data/lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb +70 -11
  20. data/lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb +77 -52
  21. data/lib/octopus_serverspec_extensions/type/octopus_deploy_smtp_config.rb +109 -0
  22. data/lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb +92 -0
  23. data/lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb +82 -0
  24. data/lib/octopus_serverspec_extensions/type/octopus_deploy_tentacle.rb +7 -8
  25. data/lib/octopus_serverspec_extensions/type/octopus_deploy_upgrade_config.rb +112 -0
  26. data/lib/octopus_serverspec_extensions/type/octopus_deploy_user.rb +111 -0
  27. data/lib/octopus_serverspec_extensions/type/octopus_deploy_worker.rb +173 -0
  28. data/lib/octopus_serverspec_extensions/type/octopus_deploy_worker_pool.rb +33 -3
  29. data/lib/octopus_serverspec_extensions/version.rb +1 -1
  30. metadata +25 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 260a7c2b8e6581eacd93f295117fa984b5e496dc51cb23c798d34c02c8411690
4
- data.tar.gz: 348f4dfda4e0cf997e881e85c79fe10146982692d7af54aa5af8b354701fe755
3
+ metadata.gz: 282b996f710e8c9a9feef460d983835143603931ad3a8864955082f967487086
4
+ data.tar.gz: 992f37a34e67a35376d65800ba12887e90923ce3cc71f8723daed742b711c67d
5
5
  SHA512:
6
- metadata.gz: 68c3951d2313d435d1f106028862489bdf3eef2dd65b1731ba01aa61e24387c750480fbca74713c5be5a25d66d10e2b176442890a7006b29340e68ad8e556314
7
- data.tar.gz: 8997eca9173dce7dfc46e0ec63af78fe043b0d7d652279128c9233ca110b937ea4d2921b37fa5d0bae9e9cd35ec41e42c3a85c05b2b3963b7da4fff4888c2b1e
6
+ metadata.gz: ea1e0139abeabbc3bb370316647cd92a057679842027f00630e678e7ca9fd4d1417b0596249ddfab79be8ec58b84272a08591d9e5283a1338772a65c1f5e2f22
7
+ data.tar.gz: 7bb2a95785aa6c6a8f1498dabe731794196b1a334fe30dd6ca92dec1203017ae6242719ca72eb5f4ca5cde509135de982750ac37a99fc0e926e1c638cf373d88
@@ -0,0 +1,45 @@
1
+ # Authenticating to your Octopus Server
2
+
3
+ There are two main ways of authenticating to your Octopus Server from your ServerSpec tests.
4
+
5
+ #### 1. Using Automatic Environment Variables
6
+
7
+ If you do not provide a URL and API key in your type call, the type will try to fall back to environment variables.
8
+
9
+ This option is much cleaner to read, and helps to protect you from leaked credentials, but can be less explicit if you're testing against multiple Octopus Instances.
10
+
11
+ | Variable | Description |
12
+ |:----------------------|:----------------------------------------------------------------------------------------|
13
+ | OCTOPUS_CLI_SERVER | The http or https URL of your Octopus Deploy server: e.g. https://octopus.example.com/ |
14
+ | OCTOPUS_CLI_API_KEY | A valid API key, with rights to view the resources you're testing |
15
+
16
+ The following example will attempt to use the Environment variables. If they are not present, it will raise an exception:
17
+
18
+ ```ruby
19
+ describe octopus_deploy_account('myawsaccount').in_space('Octopus') do
20
+ it { should exist }
21
+ end
22
+ ```
23
+
24
+ #### 2. Provide creds with each type
25
+
26
+ This method makes sense if you're testing multiple Octopus Servers in the same ruby script, and need a visual cue to which servers you're testing in a specific block.
27
+
28
+ Simply provide the URL and API key of your Octopus server as the first two parameters in your type
29
+
30
+ The following example will connect to a specific server using a specific API key:
31
+
32
+ ```ruby
33
+ describe octopus_deploy_account('https://octopus.example.com/', 'API-1234ABCDE5678FGHI', 'myawsaccount').in_space('Octopus') do
34
+ it { should exist }
35
+ end
36
+ ```
37
+
38
+ #### 3. Using your own Environment Variables
39
+ You can provide the types with a different environment variable by using Ruby's `ENV[]` hash.
40
+
41
+ ```ruby
42
+ describe octopus_deploy_smtp_config(ENV['MY_OCTOPUS_URL'], ENV['MY_OCTOPUS_API_KEY']) do
43
+ it { should be_configured }
44
+ end
45
+ ```
@@ -0,0 +1,37 @@
1
+ # octopus_deploy_account
2
+
3
+ Describes an [Octopus Infrastructure Account](https://octopus.com/docs/infrastructure/accounts).
4
+
5
+ A number of properties of Accounts (such as passwords & secret keys) are [sensitive]() values, therefore we can't directly test them.
6
+
7
+ ## Example
8
+
9
+ ```ruby
10
+
11
+ describe octopus_deploy_account("myawsaccount").in_space("Octopus") do
12
+ it { should exist }
13
+ it { should be_aws_account }
14
+ it { should_not be_azure_account }
15
+ it { should have_description('My main AWS account') }
16
+ end
17
+
18
+ ```
19
+
20
+ #### Type
21
+
22
+ ```ruby
23
+ octopus_deploy_account([server_url, api_key], account_name)
24
+ octopus_account([server_url, api_key], account_name)
25
+ ```
26
+
27
+ #### Matchers
28
+
29
+ | Matcher | Description |
30
+ |:--------|:------------|
31
+ | should exist | Tests if an account of the name exists |
32
+ | should be_aws_account | Amazon Web Services account |
33
+ | should be_azure_account | Microsoft Azure account |
34
+ | should be_ssh_key_pair | SSH keypair |
35
+ | should be_token | A token for use with services such as Kubernetes|
36
+ | should be_username_password | A username and password for use with services supporting user/pass |
37
+
@@ -0,0 +1,17 @@
1
+ # octopus_deploy_user
2
+
3
+
4
+
5
+ ## Example
6
+
7
+
8
+ #### Type
9
+
10
+ ```ruby
11
+
12
+ ```
13
+
14
+ #### Matchers
15
+
16
+ | Matcher | Description |
17
+ |:--------|:------------|
@@ -0,0 +1,33 @@
1
+ # octopus_deploy_environment
2
+
3
+ Tests an Octopus Deploy [Environment](https://octopus.com/docs/infrastructure/environments) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_environment('Production').in_space('Team Octopus') do
9
+ it { should exist }
10
+ end
11
+ ```
12
+
13
+ #### Type
14
+
15
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md), and whether your target environment is in a [Space](https://octopus.com/blog/spaces-introduction).
16
+
17
+ ```ruby
18
+ octopus_deploy_environment(url, api_key, environment_name) # url and apikey provided
19
+ octopus_deploy_environment(environment_name) # using environment vars
20
+ octopus_environment(environment_name).in_space(space_name) # using environment vars, in a [space](https://octopus.com/blog/spaces-introduction)
21
+ octopus_environment(url, api_key, environment_name)
22
+ octopus_environment(environment_name)
23
+ octopus_environment(url, api_key, environment_name).in_space(space_name)
24
+ ```
25
+
26
+ #### Matchers
27
+
28
+ | Matcher | Description |
29
+ |:--------|:------------|
30
+ | should exist | Tests for the existence of a given Environment |
31
+ | should use_guided_failure | Tests if the Environment has the Use Guided Failure default applied |
32
+ | should allow_dynamic_infrastructure | Tests if the checkbox for [Allow Dynamic Infrastructure](https://octopus.com/docs/infrastructure/environments#enabling-dynamic-infrastructure) is checked |
33
+
@@ -0,0 +1,31 @@
1
+ # octopus_deploy_project_group
2
+
3
+ Describes an Octopus [Project Group](https://octopus.com/docs/deployment-process/projects#project-group) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_project_group('Important Projects') do
9
+ it { should have_description('These are my Very Important projects') }
10
+ end
11
+ ```
12
+
13
+ #### Type
14
+
15
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
16
+
17
+ Note: `*_projectgroup` (v.1.5.x) is deprecated in favour of `*_project_group`, but included for backwards compatibility
18
+
19
+ ```ruby
20
+ octopus_deploy project_group(server_url, api_key, 'Example Group') # url and apikey provided
21
+ octopus_deploy_project_group('Example Group') # using env vars
22
+ octopus_project_group(server_url, api_key, 'Example Group') # shorthand
23
+ octopus_project_group('Example Group')
24
+ ```
25
+
26
+ #### Matchers
27
+
28
+ | Matcher | Description |
29
+ |:--------|:------------|
30
+ | should exist | Tests for existence of a project group with the given name |
31
+ | should have_description(description) | Tests if the Project group has a given description |
@@ -0,0 +1,39 @@
1
+ # octopus_deploy_smtp_config
2
+
3
+ Tests the server-wide SMTP configuration. This can be found in the Octopus Portal under Configuration -> SMTP
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_smtp_config do
9
+ it { should be_configured }
10
+ it { should have_from_address('hello@example.com') }
11
+ it { should be_using_credentials('myusername') }
12
+ it { should_not be_using_credentials('myspecialusername') }
13
+ it { should be_on_port(25) }
14
+ it { should be_on_host('smtp.example.com')}
15
+ it { should be_using_ssl }
16
+ end
17
+ ```
18
+
19
+ #### Type
20
+
21
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
22
+
23
+ ```ruby
24
+ octopus_deploy_smtp_config(server_url, api_key) # url and apikey provided
25
+ octopus_deploy_smtp_config # using environment vars
26
+ octopus_smtp_config(server_url, api_key) # shorthand
27
+ octopus_smtp_config
28
+ ```
29
+
30
+ #### Matchers
31
+
32
+ | Matcher | Description |
33
+ |:--------|:------------|
34
+ | should be_configured | Tests if the SMTP configuration has been set
35
+ | should be_on_host(host) | Tests the "SMTP Host" field |
36
+ | should be_on_port(port) | Tests the "SMTP Port" field |
37
+ | should be_using_ssl | Tests the "Use SSL/TLS" field |
38
+ | should have_from_address(address) | Tests the "From Address" field |
39
+ | should be_using_credentials(username) | Tests the "Credentials" field (username only) |
@@ -0,0 +1,32 @@
1
+ # octopus_deploy_space
2
+
3
+ Describes an Octopus Deploy [Space](https://octopus.com/docs/administration/spaces) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_space('Team Phoenix') do
9
+ it { should exist }
10
+ it { should have_running_task_queue }
11
+ end
12
+ ```
13
+
14
+ #### Type
15
+
16
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
17
+
18
+ ```ruby
19
+ octopus_deploy_space(server_url, api_key, space_name) # url and apikey provided
20
+ octopus_deploy_space(space_name) # using environment variables
21
+ octopus_space(server_url, api_key, space_name)
22
+ octopus_space(space_name) # shorthand
23
+ ```
24
+
25
+ #### Matchers
26
+
27
+ | Matcher | Description |
28
+ |:--------|:------------|
29
+ | exist | test for existence of a given space |
30
+ | be_default | Tests if this space is the default space |
31
+ | have_running_task_queue | tests if the queue for this space is disabled |
32
+ | have_description(description) | tests if the space has the specified description |
@@ -0,0 +1,26 @@
1
+ # octopus_deploy_team
2
+
3
+ Describes an Octopus Deploy [Team](https://octopus.com/docs/administration/managing-users-and-teams) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_team('Super Ninja Developer Squad') do
9
+ it { should exist }
10
+ end
11
+
12
+ ```
13
+ #### Type
14
+
15
+ ```ruby
16
+ octopus_deploy_team([url, api_key], team_name)
17
+ octopus_team([url, api_key], team_name)
18
+ octopus_team([url, api_key], team_name).in_space(space_name)
19
+
20
+ ```
21
+
22
+ #### Matchers
23
+
24
+ | Matcher | Description |
25
+ |:--------|:------------|
26
+ | should exist | Checks for existence of a team with the given name |
@@ -0,0 +1,41 @@
1
+ # octopus_deploy_tentacle
2
+
3
+ Describes an Octopus Deploy [Tentacle agent](https://octopus.com/docs/infrastructure/deployment-targets/windows-targets) resource.
4
+
5
+ Must be run on the same machine as `tentacle.exe` at present. Cannot remotely test tentacles at the present time.
6
+
7
+ ## Example
8
+
9
+ ```ruby
10
+ describe octopus_tentacle('MyTentacle') do
11
+ it { should be_polling_tentacle }
12
+ it { should have_policy('My tentacle policy')}
13
+ end
14
+ ```
15
+
16
+ #### Type
17
+
18
+ ```ruby
19
+ octopus_deploy_tentacle([url, api_key], instance_name)
20
+ octopus_tentacle([url, api_key], instance_name)
21
+ octopus_tentacle([url, api_key], instance_name).in_space('Octopus')
22
+
23
+ ```
24
+
25
+ #### Matchers
26
+
27
+ | Matcher | Description |
28
+ |:--------|:------------|
29
+ | should exist | Tests if tentacle.exe is present locally |
30
+ | should be_registered_with_the_server | Checks if this tentacle instance is present in the target server |
31
+ | should be_online | Tests if the tentacle has a status of online. If the machine is in a healthcheck, waits until healthcheck completes |
32
+ | should be_in_environment(env_name) | Tests if the tentacle is registered to a given [Environment](octopus_deploy_environment.md) |
33
+ | should be_in_space(space_name) | Tests if a tentacle appears in a given space. _deprecated_. |
34
+ | should have_tenant(tenant_name) | Tests if a tentacle is registered to a given tenant |
35
+ | should have_tenant_tag(tag_name) | Tests if a tentacle is registered to a given tenant tag |
36
+ | should have_policy(policy_name) | Tests if a tentacle has a give policy applied |
37
+ | should have_role(role_name) | Tests if a tentacle has a given role applied |
38
+ | should have_display_name | Tests if a tentacle has a given display name |
39
+ | should have_tenanted_deployment_participation(mode) | Tests if a tentacle can take part in tenanted deployments |
40
+ | should be_polling_tentacle | Tests if a tentacle is in the 'polling' or 'Active' mode |
41
+ | should be_listening_tentacle | Tests if a tentacle is in the 'listening' or 'Passive' mode |
@@ -0,0 +1,34 @@
1
+ # octopus_deploy_upgrade_config
2
+
3
+ Tests the server-wide upgrade configuration. This can be found in the UI at Configuration->Settings->Updates & Usage Telemetry.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_upgrade_config do
9
+ it { should include_statistics }
10
+ it { should never_show_notifications }
11
+ end
12
+ ```
13
+
14
+ #### Type
15
+
16
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
17
+
18
+ ```ruby
19
+ octopus_deploy_upgrade_config(server_url, api_key) # url and apikey provided
20
+ octopus_deploy_upgrade_config # using environment vars
21
+ octopus_upgrade_config(server_url, api_key) # shorthand
22
+ octopus_upgrade_config # shorthand, using env vars
23
+ ```
24
+
25
+ #### Matchers
26
+
27
+ | Matcher | Description |
28
+ |:--------|:------------|
29
+ | should have_notification_mode(mode) | Tests if the Notification mode is set to the given value. Possible values: ['AlwaysShow', 'ShowOnlyMajorMinor', 'NeverShow'] |
30
+ | should never_show_notifications | equivalent to `should_have_notification_mode('NeverShow')` |
31
+ | should always_show_notifications | equivalent to `should_have_notification_mode('AlwaysShow')` |
32
+ | should show_major_minor_notifications | equivalent to `should_have_notification_mode('ShowOnlyMajorMinor')` |
33
+ | should include_statistics | Tests if the IncludeStatistics setting is set to `true` |
34
+ | should allow_checking | Tests if the AllowChecking setting is set to `true` |
@@ -0,0 +1,34 @@
1
+ # octopus_deploy_user
2
+
3
+ Describes an Octopus Deploy [User](https://octopus.com/docs/administration/managing-users-and-teams#Managingusersandteams-UserandServiceaccounts) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_user('bobthedeveloper') do
9
+ it { should exist }
10
+ it { should be_active }
11
+ end
12
+ ```
13
+
14
+ #### Type
15
+
16
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
17
+
18
+ ```ruby
19
+ octopus_deploy_user(url, api_key, user_name) # url and apikey provided
20
+ octopus_deploy_user(user_name) # using environment vars
21
+ octopus_user(url, api_key, user_name) # shorthand
22
+ octopus_user(user_name)
23
+ ```
24
+
25
+ #### Matchers
26
+
27
+ | Matcher | Description |
28
+ |:--------|:------------|
29
+ | should exist | Tests for existence of a User account with the given name |
30
+ | should be_active | Tests if the User is enabled/has the 'Is Active' checkbox checked |
31
+ | should have_email(email) | Tests the email address associated with the User account |
32
+ | should have_api_key(purpose) | Tests if the User has an API Key with the stated purpose field |
33
+ | should have_display_name(name) | Tests the Display Name set for the User |
34
+ | should be_service_account | Tests if the User is a service account |
@@ -0,0 +1,39 @@
1
+ # octopus_deploy_worker
2
+
3
+ Describes the state of an [Octopus Deploy Worker](https://octopus.com/docs/infrastructure/workers) Agent resource
4
+
5
+ A worker is essentially a specialised version of the [Tentacle Agent](octopus_deploy_tentacle.md) resource, so this Type has much in common.
6
+
7
+ ## Example
8
+
9
+ ```ruby
10
+ describe octopus_worker('WorkerInstance').in_space('TeamBlue') do
11
+ it { should exist }
12
+ it { should be_online }
13
+ it { should be_listening_worker }
14
+ it { should have_display_name('Blue Team worker') }
15
+ end
16
+ ```
17
+
18
+
19
+ #### Type
20
+
21
+ ```ruby
22
+ octopus_deploy_worker([url, api_key], instance_name)
23
+ octopus_worker([url, api_key], instance_name)
24
+ octopus_deploy_worker([url, api_key], instance_name).in_space(space_name)
25
+
26
+ ```
27
+
28
+ #### Matchers
29
+
30
+ | Matcher | Description |
31
+ |:--------|:------------|
32
+ | should exist | Tests if tentacle.exe is present locally |
33
+ | should be_registered_with_the_server | Checks if this worker instance is present in the target server |
34
+ | should be_online | Tests if the worker has a status of 'online'. If the machine is in a healthcheck, waits until healthcheck completes |
35
+ | should be_in_space(space_name) | Tests if a worker appears in a given space. _deprecated_. |
36
+ | should have_policy(policy_name) | Tests if a worker has a give policy applied |
37
+ | should have_display_name | Tests if a worker has a given display name |
38
+ | should be_polling_worker | Tests if a worker is in the 'polling' or 'Active' mode |
39
+ | should be_listening_worker | Tests if a worker is in the 'listening' or 'Passive' mode |
@@ -0,0 +1,26 @@
1
+ # octopus_deploy_worker_pool
2
+
3
+ Describes an Octopus Deploy [Worker Pool](https://octopus.com/docs/infrastructure/workers/worker-pools) resource.
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ describe octopus_deploy_worker_pool('My Worker Pool').in_space("My Space") do
9
+ it { should exist }
10
+ end
11
+ ```
12
+
13
+ This type can be instantiated in several ways, depending on [how you authenticate](authentication.md).
14
+
15
+ #### Type
16
+
17
+ ```ruby
18
+ octopus_deploy_worker_pool('My Worker Pool').in_space("My Space")
19
+ octopus_worker_pool('Pool in Default Space')
20
+ ```
21
+
22
+ #### Matchers
23
+
24
+ | Matcher | Description |
25
+ |:--------|:------------|
26
+ | should exist | Tests for existence of a pool with this name |