-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: slight refactoring ahead of peering testing improvements (#17387)
- Loading branch information
Showing
6 changed files
with
139 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,32 @@ | ||
package utils | ||
|
||
import "github.com/hashicorp/consul/api" | ||
|
||
func PartitionOrDefault(name string) string { | ||
if name == "" { | ||
return "default" | ||
} | ||
return name | ||
} | ||
func NamespaceOrDefault(name string) string { | ||
if name == "" { | ||
return "default" | ||
} | ||
return name | ||
} | ||
|
||
func DefaultToEmpty(name string) string { | ||
if name == "default" { | ||
return "" | ||
} | ||
return name | ||
} | ||
|
||
// PartitionQueryOptions returns an *api.QueryOptions with the given partition | ||
// field set only if the partition is non-default. This helps when writing | ||
// tests for joint use in OSS and ENT. | ||
func PartitionQueryOptions(partition string) *api.QueryOptions { | ||
return &api.QueryOptions{ | ||
Partition: DefaultToEmpty(partition), | ||
} | ||
} |
This file contains 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 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 |
---|---|---|
|
@@ -9,4 +9,5 @@ package utils | |
const ( | ||
defaultImageName = DefaultImageNameOSS | ||
ImageVersionSuffix = "" | ||
isInEnterpriseRepo = false | ||
) |