-
Notifications
You must be signed in to change notification settings - Fork 49
chore: refactor networkedge to Internal/ #622
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
Draft
displague
wants to merge
8
commits into
main
Choose a base branch
from
internal_networkedge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
70e04ea
refactor: move networkedge files to internal/resources
displague f0a04b2
refactor: rename NE packages and export Resource/DataSource
displague ceb7b07
refactor: remove stringsFound and slicesMatch (use comparisons pkg)
displague a7c1f8f
refactor: isEmpty to comparisons.IsEmpty
displague 5c4bb8c
refactor: replace deprecated functions with comparisons pkg equivalents
displague 4c7a525
chore(ci): refactor NE acceptance+sweep tests to avoid import cycles
displague cfb386c
refactor: move NE sweepers to sweeper.go style
displague 921c699
chore(goimports): goimports -w -local github.com/equinix/terraform-pr…
displague 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,11 @@ | ||
| package equinix | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strconv" | ||
| "strings" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/equinix/terraform-provider-equinix/internal/config" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
| ) | ||
|
|
||
| const tstResourcePrefix = "tfacc" | ||
|
|
||
| func TestMain(m *testing.M) { | ||
| resource.TestMain(m) | ||
| } | ||
|
|
||
| func sharedConfigForRegion(region string) (*config.Config, error) { | ||
| endpoint := getFromEnvDefault(config.EndpointEnvVar, config.DefaultBaseURL) | ||
| clientToken := getFromEnvDefault(config.ClientTokenEnvVar, "") | ||
| clientID := getFromEnvDefault(config.ClientIDEnvVar, "") | ||
| clientSecret := getFromEnvDefault(config.ClientSecretEnvVar, "") | ||
| clientTimeout := getFromEnvDefault(config.ClientTimeoutEnvVar, strconv.Itoa(config.DefaultTimeout)) | ||
| clientTimeoutInt, err := strconv.Atoi(clientTimeout) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("cannot convert value of '%s' env variable to int", config.ClientTimeoutEnvVar) | ||
| } | ||
| metalAuthToken := getFromEnvDefault(config.MetalAuthTokenEnvVar, "") | ||
|
|
||
| if clientToken == "" && (clientID == "" || clientSecret == "") && metalAuthToken == "" { | ||
| return nil, fmt.Errorf("To run acceptance tests sweeper, one of '%s' or pair '%s' - '%s' must be set for Equinix Fabric and Network Edge, and '%s' for Equinix Metal", | ||
| config.ClientTokenEnvVar, config.ClientIDEnvVar, config.ClientSecretEnvVar, config.MetalAuthTokenEnvVar) | ||
| } | ||
|
|
||
| return &config.Config{ | ||
| AuthToken: metalAuthToken, | ||
| BaseURL: endpoint, | ||
| Token: clientToken, | ||
| ClientID: clientID, | ||
| ClientSecret: clientSecret, | ||
| RequestTimeout: time.Duration(clientTimeoutInt) * time.Second, | ||
| }, nil | ||
| } | ||
|
|
||
| func isSweepableTestResource(namePrefix string) bool { | ||
| return strings.HasPrefix(namePrefix, tstResourcePrefix) | ||
| } |
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
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.