-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: support skip nightly tests by distro/host
- Loading branch information
1 parent
a85d6f7
commit ede797c
Showing
12 changed files
with
128 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nightly: | ||
ec2: | ||
enabled: true |
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,7 @@ | ||
package spec | ||
|
||
type NightlySystemUnderTest struct { | ||
HostNamePattern string | ||
ExcludedMetrics []string | ||
SkipIf func(testSpec *TestSpec) bool | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package spec | ||
|
||
import "test/e2e/util/assert" | ||
import ( | ||
"test/e2e/util/assert" | ||
) | ||
|
||
type TestCase struct { | ||
Name string | ||
|
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,34 @@ | ||
package spec | ||
|
||
import ( | ||
"fmt" | ||
"gopkg.in/yaml.v3" | ||
"os" | ||
envutil "test/e2e/util/env" | ||
testutil "test/e2e/util/test" | ||
) | ||
|
||
type TestSpec struct { | ||
Nightly struct { | ||
EC2 struct { | ||
Enabled bool `yaml:"enabled"` | ||
} `yaml:"ec2"` | ||
} `yaml:"nightly"` | ||
} | ||
|
||
func LoadTestSpec() *TestSpec { | ||
distro := envutil.GetDistro() | ||
testSpecFile := testutil.NewPathRelativeToRootDir("distributions/" + distro + "/test-spec.yaml") | ||
testSpecData, err := os.ReadFile(testSpecFile) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to read test spec file: %w", err)) | ||
} | ||
|
||
var testSpec TestSpec | ||
err = yaml.Unmarshal(testSpecData, &testSpec) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to unmarshal test spec: %w", err)) | ||
} | ||
|
||
return &testSpec | ||
} |
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 |
---|---|---|
@@ -1,17 +1,28 @@ | ||
package test | ||
|
||
import "fmt" | ||
import ( | ||
"strings" | ||
envutil "test/e2e/util/env" | ||
) | ||
|
||
const ( | ||
Wildcard = "%" | ||
hostNameSegmentSeparator = "-" | ||
) | ||
|
||
func NewHostNamePrefix(envName string, deployId string, hostType string) string { | ||
// TODO: incorporate distro into hostname when generalizing nightly to support multiple distro | ||
distro := getNormalizedDistro() | ||
// only a prefix as helm chart appends hostId | ||
return fmt.Sprintf("%s-%s-%s", envName, deployId, hostType) | ||
return strings.Join([]string{envName, deployId, distro, hostType}, hostNameSegmentSeparator) | ||
} | ||
|
||
const Wildcard = "%" | ||
|
||
func NewNrQueryHostNamePattern(envName string, deployId string, hostType string) string { | ||
// TODO: incorporate distro into hostname when generalizing nightly to support multiple distro | ||
distro := getNormalizedDistro() | ||
hostId := Wildcard | ||
return fmt.Sprintf("%s-%s-%s-%s", envName, deployId, hostType, hostId) | ||
return strings.Join([]string{envName, deployId, distro, hostType, hostId}, hostNameSegmentSeparator) | ||
} | ||
|
||
func getNormalizedDistro() string { | ||
// solely to improve readability - no technical necessity | ||
return strings.Replace(envutil.GetDistro(), hostNameSegmentSeparator, "_", -1) | ||
} |
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,25 @@ | ||
package test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path" | ||
"strings" | ||
) | ||
|
||
func NewPathRelativeToRootDir(pathFromRoot string) string { | ||
pwd, err := os.Getwd() | ||
if err != nil { | ||
panic(err) | ||
} | ||
rootDir := path.Clean(fmt.Sprintf("%s/../../..", pwd)) | ||
|
||
if _, err := os.Stat(path.Join(rootDir, ".github")); err != nil { | ||
panic(fmt.Errorf("unexpected directory structure: %s should be the root dir (pwd: %s) but encountered error %w", rootDir, pwd, err)) | ||
} | ||
var result = rootDir | ||
for _, segment := range strings.Split(pathFromRoot, "/") { | ||
result = path.Join(result, segment) | ||
} | ||
return result | ||
} |
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