Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2a22f9d

Browse filesBrowse files
committed
tests: Devolve acceptance test conditions
Place service-specific conditions in service-specific locations. We also removed the now-unused RequireNovaNetwork helper. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent 69b5446 commit 2a22f9d
Copy full SHA for 2a22f9d
Expand file treeCollapse file tree

26 files changed

+152
-121
lines changed

‎internal/acceptance/clients/conditions.go

Copy file name to clipboardExpand all lines: internal/acceptance/clients/conditions.go
+13-84Lines changed: 13 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ func RequiredSystemScope(t *testing.T) {
1414
}
1515
}
1616

17-
// RequireManilaReplicas will restrict a test to only be run with enabled
18-
// manila replicas.
19-
func RequireManilaReplicas(t *testing.T) {
20-
if os.Getenv("OS_MANILA_REPLICAS") != "true" {
21-
t.Skip("manila replicas must be enabled to run this test")
22-
}
23-
}
24-
2517
// RequireAdmin will restrict a test to only be run by admin users.
2618
func RequireAdmin(t *testing.T) {
2719
if os.Getenv("OS_USERNAME") != "admin" {
@@ -36,77 +28,13 @@ func RequireNonAdmin(t *testing.T) {
3628
}
3729
}
3830

39-
// RequirePortForwarding will restrict a test to only be run in environments
40-
// that support port forwarding
41-
func RequirePortForwarding(t *testing.T) {
42-
if os.Getenv("OS_PORTFORWARDING_ENVIRONMENT") == "" {
43-
t.Skip("this test requires support for port forwarding")
44-
}
45-
}
46-
47-
// RequireGuestAgent will restrict a test to only be run in
48-
// environments that support the QEMU guest agent.
49-
func RequireGuestAgent(t *testing.T) {
50-
if os.Getenv("OS_GUEST_AGENT") == "" {
51-
t.Skip("this test requires support for qemu guest agent and to set OS_GUEST_AGENT to 1")
52-
}
53-
}
54-
55-
// RequireIdentityV2 will restrict a test to only be run in
56-
// environments that support the Identity V2 API.
57-
func RequireIdentityV2(t *testing.T) {
58-
if os.Getenv("OS_IDENTITY_API_VERSION") != "2.0" {
59-
t.Skip("this test requires support for the identity v2 API")
60-
}
61-
}
62-
63-
// RequireLiveMigration will restrict a test to only be run in
64-
// environments that support live migration.
65-
func RequireLiveMigration(t *testing.T) {
66-
if os.Getenv("OS_LIVE_MIGRATE") == "" {
67-
t.Skip("this test requires support for live migration and to set OS_LIVE_MIGRATE to 1")
68-
}
69-
}
70-
7131
// RequireLong will ensure long-running tests can run.
7232
func RequireLong(t *testing.T) {
7333
if testing.Short() {
7434
t.Skip("skipping test in short mode")
7535
}
7636
}
7737

78-
// RequireNovaNetwork will restrict a test to only be run in
79-
// environments that support nova-network.
80-
func RequireNovaNetwork(t *testing.T) {
81-
if os.Getenv("OS_NOVANET") == "" {
82-
t.Skip("this test requires nova-network and to set OS_NOVANET to 1")
83-
}
84-
}
85-
86-
// RequireCinderNoAuth will restrict a test to be only run in environments that
87-
// have Cinder using noauth.
88-
func RequireCinderNoAuth(t *testing.T) {
89-
if os.Getenv("CINDER_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" {
90-
t.Skip("this test requires Cinder using noauth, set OS_USERNAME and CINDER_ENDPOINT")
91-
}
92-
}
93-
94-
// RequireIronicNoAuth will restrict a test to be only run in environments that
95-
// have Ironic using noauth.
96-
func RequireIronicNoAuth(t *testing.T) {
97-
if os.Getenv("IRONIC_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" {
98-
t.Skip("this test requires IRONIC using noauth, set OS_USERNAME and IRONIC_ENDPOINT")
99-
}
100-
}
101-
102-
// RequireIronicHTTPBasic will restrict a test to be only run in environments
103-
// that have Ironic using http_basic.
104-
func RequireIronicHTTPBasic(t *testing.T) {
105-
if os.Getenv("IRONIC_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" || os.Getenv("OS_PASSWORD") == "" {
106-
t.Skip("this test requires Ironic using http_basic, set OS_USERNAME, OS_PASSWORD and IRONIC_ENDPOINT")
107-
}
108-
}
109-
11038
func getReleaseFromEnv(t *testing.T) string {
11139
current := strings.TrimPrefix(os.Getenv("OS_BRANCH"), "stable/")
11240
if current == "" {
@@ -115,17 +43,17 @@ func getReleaseFromEnv(t *testing.T) string {
11543
return current
11644
}
11745

118-
// SkipRelease will have the test be skipped on a certain
119-
// release. Releases are named such as 'stable/mitaka', master, etc.
46+
// SkipRelease will have the test be skipped on a certain release.
47+
// Releases are named such as 'stable/dalmatian', master, etc.
12048
func SkipRelease(t *testing.T, release string) {
12149
current := getReleaseFromEnv(t)
12250
if current == strings.TrimPrefix(release, "stable/") {
12351
t.Skipf("this is not supported in %s", release)
12452
}
12553
}
12654

127-
// SkipReleasesBelow will have the test be skipped on releases below a certain
128-
// one. Releases are named such as 'stable/mitaka', master, etc.
55+
// SkipReleasesBelow will have the test be skipped on releases below a certain one.
56+
// Releases are named such as 'stable/dalmatian', master, etc.
12957
func SkipReleasesBelow(t *testing.T, release string) {
13058
current := getReleaseFromEnv(t)
13159

@@ -134,9 +62,9 @@ func SkipReleasesBelow(t *testing.T, release string) {
13462
}
13563
}
13664

137-
// SkipReleasesAbove will have the test be skipped on releases above a certain
138-
// one. The test is always skipped on master release. Releases are named such
139-
// as 'stable/mitaka', master, etc.
65+
// SkipReleasesAbove will have the test be skipped on releases above a certain one.
66+
// The test is always skipped on master release.
67+
// Releases are named such as 'stable/dalmatian', master, etc.
14068
func SkipReleasesAbove(t *testing.T, release string) {
14169
current := getReleaseFromEnv(t)
14270

@@ -150,9 +78,9 @@ func isReleaseNumeral(release string) bool {
15078
return err == nil
15179
}
15280

153-
// IsCurrentAbove will return true on releases above a certain
154-
// one. The result is always true on master release. Releases are named such
155-
// as 'stable/mitaka', master, etc.
81+
// IsCurrentAbove will return true on releases above a certain one.
82+
// The result is always true on master release.
83+
// Releases are named such as 'stable/dalmatian', master, etc.
15684
func IsCurrentAbove(t *testing.T, release string) bool {
15785
current := getReleaseFromEnv(t)
15886
release = strings.TrimPrefix(release, "stable/")
@@ -174,8 +102,9 @@ func IsCurrentAbove(t *testing.T, release string) bool {
174102
return false
175103
}
176104

177-
// IsCurrentBelow will return true on releases below a certain
178-
// one. Releases are named such as 'stable/mitaka', master, etc.
105+
// IsCurrentBelow will return true on releases below a certain one.
106+
// The result is always false on master release.
107+
// Releases are named such as 'stable/dalmatian', master, etc.
179108
func IsCurrentBelow(t *testing.T, release string) bool {
180109
current := getReleaseFromEnv(t)
181110
release = strings.TrimPrefix(release, "stable/")

‎internal/acceptance/openstack/baremetal/httpbasic/allocations_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/httpbasic/allocations_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
func TestAllocationsCreateDestroy(t *testing.T) {
1717
clients.RequireLong(t)
18-
clients.RequireIronicHTTPBasic(t)
18+
RequireIronicHTTPBasic(t)
1919

2020
client, err := clients.NewBareMetalV1HTTPBasic()
2121
th.AssertNoErr(t, err)
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package httpbasic
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
// RequireIronicHTTPBasic will restrict a test to be only run in environments
9+
// that have Ironic using http_basic.
10+
func RequireIronicHTTPBasic(t *testing.T) {
11+
if os.Getenv("IRONIC_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" || os.Getenv("OS_PASSWORD") == "" {
12+
t.Skip("this test requires Ironic using http_basic, set OS_USERNAME, OS_PASSWORD and IRONIC_ENDPOINT")
13+
}
14+
}

‎internal/acceptance/openstack/baremetal/httpbasic/nodes_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/httpbasic/nodes_test.go
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestNodesCreateDestroy(t *testing.T) {
1818
clients.RequireLong(t)
19-
clients.RequireIronicHTTPBasic(t)
19+
RequireIronicHTTPBasic(t)
2020

2121
client, err := clients.NewBareMetalV1HTTPBasic()
2222
th.AssertNoErr(t, err)
@@ -49,7 +49,7 @@ func TestNodesCreateDestroy(t *testing.T) {
4949

5050
func TestNodesUpdate(t *testing.T) {
5151
clients.RequireLong(t)
52-
clients.RequireIronicHTTPBasic(t)
52+
RequireIronicHTTPBasic(t)
5353

5454
client, err := clients.NewBareMetalV1HTTPBasic()
5555
th.AssertNoErr(t, err)
@@ -74,7 +74,7 @@ func TestNodesUpdate(t *testing.T) {
7474
func TestNodesRAIDConfig(t *testing.T) {
7575
clients.SkipReleasesBelow(t, "stable/ussuri")
7676
clients.RequireLong(t)
77-
clients.RequireIronicHTTPBasic(t)
77+
RequireIronicHTTPBasic(t)
7878

7979
client, err := clients.NewBareMetalV1HTTPBasic()
8080
th.AssertNoErr(t, err)
@@ -104,7 +104,7 @@ func TestNodesRAIDConfig(t *testing.T) {
104104
func TestNodesFirmwareInterface(t *testing.T) {
105105
clients.SkipReleasesBelow(t, "stable/2023.2")
106106
clients.RequireLong(t)
107-
clients.RequireIronicHTTPBasic(t)
107+
RequireIronicHTTPBasic(t)
108108

109109
client, err := clients.NewBareMetalV1HTTPBasic()
110110
th.AssertNoErr(t, err)

‎internal/acceptance/openstack/baremetal/httpbasic/portgroups_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/httpbasic/portgroups_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
func TestPortGroupsCreateDestroy(t *testing.T) {
1717
clients.RequireLong(t)
18-
clients.RequireIronicHTTPBasic(t)
18+
RequireIronicHTTPBasic(t)
1919

2020
client, err := clients.NewBareMetalV1HTTPBasic()
2121
th.AssertNoErr(t, err)

‎internal/acceptance/openstack/baremetal/httpbasic/ports_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/httpbasic/ports_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestPortsCreateDestroy(t *testing.T) {
1818
clients.RequireLong(t)
19-
clients.RequireIronicHTTPBasic(t)
19+
RequireIronicHTTPBasic(t)
2020

2121
client, err := clients.NewBareMetalV1HTTPBasic()
2222
th.AssertNoErr(t, err)
@@ -52,7 +52,7 @@ func TestPortsCreateDestroy(t *testing.T) {
5252

5353
func TestPortsUpdate(t *testing.T) {
5454
clients.RequireLong(t)
55-
clients.RequireIronicHTTPBasic(t)
55+
RequireIronicHTTPBasic(t)
5656

5757
client, err := clients.NewBareMetalV1HTTPBasic()
5858
th.AssertNoErr(t, err)

‎internal/acceptance/openstack/baremetal/noauth/allocations_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/noauth/allocations_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
func TestAllocationsCreateDestroy(t *testing.T) {
1717
clients.RequireLong(t)
18-
clients.RequireIronicNoAuth(t)
18+
RequireIronicNoAuth(t)
1919

2020
client, err := clients.NewBareMetalV1NoAuthClient()
2121
th.AssertNoErr(t, err)
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package noauth
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
// RequireIronicNoAuth will restrict a test to be only run in environments that
9+
10+
// have Ironic using noauth.
11+
func RequireIronicNoAuth(t *testing.T) {
12+
if os.Getenv("IRONIC_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" {
13+
t.Skip("this test requires IRONIC using noauth, set OS_USERNAME and IRONIC_ENDPOINT")
14+
}
15+
}

‎internal/acceptance/openstack/baremetal/noauth/nodes_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/noauth/nodes_test.go
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestNodesCreateDestroy(t *testing.T) {
1818
clients.RequireLong(t)
19-
clients.RequireIronicNoAuth(t)
19+
RequireIronicNoAuth(t)
2020

2121
client, err := clients.NewBareMetalV1NoAuthClient()
2222
th.AssertNoErr(t, err)
@@ -49,7 +49,7 @@ func TestNodesCreateDestroy(t *testing.T) {
4949

5050
func TestNodesUpdate(t *testing.T) {
5151
clients.RequireLong(t)
52-
clients.RequireIronicNoAuth(t)
52+
RequireIronicNoAuth(t)
5353

5454
client, err := clients.NewBareMetalV1NoAuthClient()
5555
th.AssertNoErr(t, err)
@@ -74,7 +74,7 @@ func TestNodesUpdate(t *testing.T) {
7474
func TestNodesRAIDConfig(t *testing.T) {
7575
clients.SkipReleasesBelow(t, "stable/ussuri")
7676
clients.RequireLong(t)
77-
clients.RequireIronicNoAuth(t)
77+
RequireIronicNoAuth(t)
7878

7979
client, err := clients.NewBareMetalV1NoAuthClient()
8080
th.AssertNoErr(t, err)

‎internal/acceptance/openstack/baremetal/noauth/ports_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/baremetal/noauth/ports_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestPortsCreateDestroy(t *testing.T) {
1818
clients.RequireLong(t)
19-
clients.RequireIronicNoAuth(t)
19+
RequireIronicNoAuth(t)
2020

2121
client, err := clients.NewBareMetalV1NoAuthClient()
2222
th.AssertNoErr(t, err)
@@ -52,7 +52,7 @@ func TestPortsCreateDestroy(t *testing.T) {
5252

5353
func TestPortsUpdate(t *testing.T) {
5454
clients.RequireLong(t)
55-
clients.RequireIronicNoAuth(t)
55+
RequireIronicNoAuth(t)
5656

5757
client, err := clients.NewBareMetalV1NoAuthClient()
5858
th.AssertNoErr(t, err)
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package noauth
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
// RequireCinderNoAuth will restrict a test to be only run in environments that
9+
// have Cinder using noauth.
10+
func RequireCinderNoAuth(t *testing.T) {
11+
if os.Getenv("CINDER_ENDPOINT") == "" || os.Getenv("OS_USERNAME") == "" {
12+
t.Skip("this test requires Cinder using noauth, set OS_USERNAME and CINDER_ENDPOINT")
13+
}
14+
}

‎internal/acceptance/openstack/blockstorage/noauth/snapshots_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/blockstorage/noauth/snapshots_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
func TestSnapshotsList(t *testing.T) {
15-
clients.RequireCinderNoAuth(t)
15+
RequireCinderNoAuth(t)
1616

1717
client, err := clients.NewBlockStorageV3NoAuthClient()
1818
if err != nil {
@@ -35,7 +35,7 @@ func TestSnapshotsList(t *testing.T) {
3535
}
3636

3737
func TestSnapshotsCreateDelete(t *testing.T) {
38-
clients.RequireCinderNoAuth(t)
38+
RequireCinderNoAuth(t)
3939

4040
client, err := clients.NewBlockStorageV3NoAuthClient()
4141
if err != nil {

‎internal/acceptance/openstack/blockstorage/noauth/volumes_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/blockstorage/noauth/volumes_test.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
func TestVolumesList(t *testing.T) {
15-
clients.RequireCinderNoAuth(t)
15+
RequireCinderNoAuth(t)
1616

1717
client, err := clients.NewBlockStorageV3NoAuthClient()
1818
if err != nil {
@@ -35,7 +35,7 @@ func TestVolumesList(t *testing.T) {
3535
}
3636

3737
func TestVolumesCreateDestroy(t *testing.T) {
38-
clients.RequireCinderNoAuth(t)
38+
RequireCinderNoAuth(t)
3939

4040
client, err := clients.NewBlockStorageV3NoAuthClient()
4141
if err != nil {
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package v2
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
// RequireGuestAgent will restrict a test to only be run in
9+
// environments that support the QEMU guest agent.
10+
func RequireGuestAgent(t *testing.T) {
11+
if os.Getenv("OS_GUEST_AGENT") == "" {
12+
t.Skip("this test requires support for qemu guest agent and to set OS_GUEST_AGENT to 1")
13+
}
14+
}
15+
16+
// RequireLiveMigration will restrict a test to only be run in
17+
// environments that support live migration.
18+
func RequireLiveMigration(t *testing.T) {
19+
if os.Getenv("OS_LIVE_MIGRATE") == "" {
20+
t.Skip("this test requires support for live migration and to set OS_LIVE_MIGRATE to 1")
21+
}
22+
}

‎internal/acceptance/openstack/compute/v2/migrate_test.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/compute/v2/migrate_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestMigrate(t *testing.T) {
3131
func TestLiveMigrate(t *testing.T) {
3232
clients.RequireLong(t)
3333
clients.RequireAdmin(t)
34-
clients.RequireLiveMigration(t)
34+
RequireLiveMigration(t)
3535

3636
client, err := clients.NewComputeV2Client()
3737
th.AssertNoErr(t, err)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.