-
Notifications
You must be signed in to change notification settings - Fork 7
test(e2e): Use parallel tests for providers other than Docker #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2192b15
test(e2e): Use parallel tests for providers other than Docker
jimmidyson c3edb0e
test(e2e): Reserve and unreserve CP endpoint IP per test cluster
jimmidyson 0a2f9a3
fixup! test(e2e): Fix up e2e tests
jimmidyson cb3277d
fixup! ci: Remove unnecessary step to get CP endpoint IP
jimmidyson e5af2fd
fixup! build: Remove now unused make target
jimmidyson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//go:build e2e | ||
|
||
// Copyright 2024 Nutanix. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package nutanix | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
prismcommonapi "github.com/nutanix/ntnx-api-golang-clients/prism-go-client/v4/models/common/v1/config" | ||
prismapi "github.com/nutanix/ntnx-api-golang-clients/prism-go-client/v4/models/prism/v4/config" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
"k8s.io/utils/ptr" | ||
"sigs.k8s.io/cluster-api/test/framework/clusterctl" | ||
|
||
prismgoclient "github.com/nutanix-cloud-native/prism-go-client" | ||
prismclientv4 "github.com/nutanix-cloud-native/prism-go-client/v4" | ||
) | ||
|
||
const ( | ||
prismEndpointVariableName = "NUTANIX_ENDPOINT" | ||
prismPortVariableName = "NUTANIX_PORT" | ||
prismUsernameVariableName = "NUTANIX_USER" | ||
prismPasswordVariableName = "NUTANIX_PASSWORD" | ||
) | ||
|
||
func CredentialsFromCAPIE2EConfig(e2eConfig *clusterctl.E2EConfig) *prismgoclient.Credentials { | ||
return &prismgoclient.Credentials{ | ||
Endpoint: e2eConfig.GetVariable(prismEndpointVariableName), | ||
Port: e2eConfig.GetVariable(prismPortVariableName), | ||
Username: e2eConfig.GetVariable(prismUsernameVariableName), | ||
Password: e2eConfig.GetVariable(prismPasswordVariableName), | ||
Insecure: false, | ||
} | ||
} | ||
|
||
func NewV4Client(credentials *prismgoclient.Credentials) (*prismclientv4.Client, error) { | ||
v4Client, err := prismclientv4.NewV4Client(*credentials) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create Nutanix V4 API client: %w", err) | ||
} | ||
|
||
return v4Client, nil | ||
} | ||
|
||
func WaitForTaskCompletion( | ||
ctx context.Context, | ||
taskID string, | ||
v4Client *prismclientv4.Client, | ||
) ([]prismcommonapi.KVPair, error) { | ||
var data []prismcommonapi.KVPair | ||
|
||
if err := wait.PollUntilContextCancel( | ||
ctx, | ||
100*time.Millisecond, | ||
true, | ||
func(ctx context.Context) (done bool, err error) { | ||
task, err := v4Client.TasksApiInstance.GetTaskById(ptr.To(taskID)) | ||
if err != nil { | ||
return false, fmt.Errorf("failed to get task %s: %w", taskID, err) | ||
} | ||
|
||
taskData, ok := task.GetData().(prismapi.Task) | ||
if !ok { | ||
return false, fmt.Errorf("unexpected task data type %[1]T: %+[1]v", task.GetData()) | ||
} | ||
|
||
if ptr.Deref(taskData.Status, prismapi.TASKSTATUS_UNKNOWN) != prismapi.TASKSTATUS_SUCCEEDED { | ||
return false, nil | ||
} | ||
|
||
data = taskData.CompletionDetails | ||
|
||
return true, nil | ||
}, | ||
); err != nil { | ||
return nil, fmt.Errorf("failed to wait for task %s to complete: %w", taskID, err) | ||
} | ||
|
||
return data, nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.