Skip to content

Commit

Permalink
feat(KONFLUX-3150): add component-specific labels to e2e-tests (#1260)
Browse files Browse the repository at this point in the history
Signed-off-by: Kasem Alem <[email protected]>
  • Loading branch information
kasemAlem authored Jul 24, 2024
1 parent ecbc638 commit 7283698
Show file tree
Hide file tree
Showing 26 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion cmd/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
_ "github.com/konflux-ci/e2e-tests/tests/build"
_ "github.com/konflux-ci/e2e-tests/tests/enterprise-contract"
_ "github.com/konflux-ci/e2e-tests/tests/integration-service"
_ "github.com/konflux-ci/e2e-tests/tests/konflux-demo"
_ "github.com/konflux-ci/e2e-tests/tests/release/pipelines"
_ "github.com/konflux-ci/e2e-tests/tests/release/service"
_ "github.com/konflux-ci/e2e-tests/tests/rhtap-demo"
_ "github.com/konflux-ci/e2e-tests/tests/upgrade"

"flag"
Expand Down
2 changes: 1 addition & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export UPGRADE_BRANCH=quality-dashboard
# Default value(if not specified): redhat-appstudio
export UPGRADE_FORK_ORGANIZATION=redhat-appstudio-qe

# Setting this env var to "true" makes rhtap-demo test scenario to skip cleanup.
# Setting this env var to "true" makes konflux-demo test scenario to skip cleanup.
# Implemented as part of https://issues.redhat.com/browse/RHTAPBUGS-890
# export E2E_SKIP_CLEANUP=true

Expand Down
14 changes: 7 additions & 7 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $ go mod tidy
<p>

Some tests could require you have a Github App created in order to test Component builds via Pipelines as Code.
Such tests are [rhtap-demo](https://github.com/konflux-ci/e2e-tests/blob/main/tests/rhtap-demo/rhtap-demo.go), [build](https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build.go), and [status-reporting-to-pullrequest](https://github.com/konflux-ci/e2e-tests/blob/main/tests/integration-service/status-reporting-to-pullrequest.go).
Such tests are [konflux-demo](https://github.com/konflux-ci/e2e-tests/blob/main/tests/konflux-demo/konflux-demo.go), [build](https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build.go), and [status-reporting-to-pullrequest](https://github.com/konflux-ci/e2e-tests/blob/main/tests/integration-service/status-reporting-to-pullrequest.go).

In this case, before you bootstrap a cluster, make sure you [created a Github App for your GitHub account](https://github.com/settings/apps). Fill in following details:
</p>
Expand All @@ -72,7 +72,7 @@ export E2E_PAC_GITHUB_APP_PRIVATE_KEY=$(base64 < /PATH/TO/YOUR/DOWNLOADED/PRIVAT
```
<p>
Navigate back to <a href="https://github.com/settings/apps">your GitHub App</a>, select Install App and select your GitHub org (the one that you're using in `MY_GITHUB_ORG` env var). Feel free to install it to all repositories of that organization or the forked repositories currently used by <a href="(https://github.com/konflux-ci/e2e-tests/blob/main/tests/rhtap-demo/rhtap-demo.go)">rhtap-demo</a> and <a href="(https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build.go">build tests</a>
Navigate back to <a href="https://github.com/settings/apps">your GitHub App</a>, select Install App and select your GitHub org (the one that you're using in `MY_GITHUB_ORG` env var). Feel free to install it to all repositories of that organization or the forked repositories currently used by <a href="(https://github.com/konflux-ci/e2e-tests/blob/main/tests/konflux-demo/konflux-demo.go)">konflux-demo</a> and <a href="(https://github.com/konflux-ci/e2e-tests/blob/main/tests/build/build.go">build tests</a>
</p>

</details>
Expand All @@ -83,7 +83,7 @@ For bootstrapping a cluster, run the following command:
make local/cluster/prepare
```

More information about how to deploy RHTAP
More information about how to deploy KONFLUX
are in the [infra-deployments](https://github.com/redhat-appstudio/infra-deployments) repository.

### Building and running the e2e tests
Expand All @@ -94,8 +94,8 @@ In that case, before you run the test, make sure you have created
* also make sure that the docker config, that is encoded in the value of `QUAY_TOKEN` environment variable, contains a correct credentials required to push to `test-images` repo. And make sure the robot account or user account has the **write** permissions set for `test-images` repo which is required by the tests to push the generated artifacts.
* fork following GitHub repositories to your org (specified in `MY_GITHUB_ORG` env var)
* https://github.com/redhat-appstudio-qe/devfile-sample-hello-world (for running build-service tests)
* https://github.com/redhat-appstudio-qe/hacbs-test-project (for rhtap-demo test)
* https://github.com/redhat-appstudio-qe/strategy-configs (for rhtap-demo test)
* https://github.com/redhat-appstudio-qe/hacbs-test-project (for konflux-demo test)
* https://github.com/redhat-appstudio-qe/strategy-configs (for konflux-demo test)
* https://github.com/redhat-appstudio-qe/hacbs-test-project-integration (for status-reporting-to-pullrequest test)

Note: All Environments used in all e2e-tests are in [default.env](../default.env) file. In case you need to run a specific tests, not all environments are necessary to be defined.
Expand Down Expand Up @@ -124,11 +124,11 @@ The `e2e-appstudio` command is the root command that executes all test functiona
```
Note: The binary must be updated by running `make build` every time there are new changes in the tests.

The instructions for every test suite can be found in the [tests folder](tests), e.g. [has Readme.md](tests/rhtap-demo/README.md).
The instructions for every test suite can be found in the [tests folder](tests), e.g. [has Readme.md](tests/konflux-demo/README.md).
You can also specify which tests you want to run using [labels](docs/LabelsNaming.md) or [Ginkgo Focus](docs/DeveloperFocus.md).


## RHTAP in Openshift CI and branch pairing
## KONFLUX in Openshift CI and branch pairing

The e2e tests are executed against almost all AppStudio repositories.

Expand Down
12 changes: 6 additions & 6 deletions magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ func (Local) CleanupQuayTags() error {
return cleanupQuayTags(quayClient, quayOrg, "test-images")
}

// Deletes the private repos with prefix "build-e2e" or "rhtap-demo"
// Deletes the private repos whose names match prefixes as stored in `repoNamePrefixes` array
func (Local) CleanupPrivateRepos() error {
repoNamePrefixes := []string{"build-e2e", "rhtap-demo", "multi-platform", "jvm-build"}
repoNamePrefixes := []string{"build-e2e", "konflux", "multi-platform", "jvm-build-service"}
quayOrgToken := os.Getenv("DEFAULT_QUAY_ORG_TOKEN")
if quayOrgToken == "" {
return fmt.Errorf(quayTokenNotFoundError)
Expand Down Expand Up @@ -408,7 +408,7 @@ func setRequiredEnvVars() error {
requiresSprayProxyRegistering = true
envVarPrefix = "HAS"
imageTagSuffix = "has-image"
testSuiteLabel = "rhtap-demo"
testSuiteLabel = "konflux"
case strings.Contains(jobName, "release-service"):
envVarPrefix = "RELEASE_SERVICE"
imageTagSuffix = "release-service-image"
Expand All @@ -422,7 +422,7 @@ func setRequiredEnvVars() error {
case strings.Contains(jobName, "jvm-build-service"):
envVarPrefix = "JVM_BUILD_SERVICE"
imageTagSuffix = "jvm-build-service-image"
testSuiteLabel = "jvm-build"
testSuiteLabel = "jvm-build-service"
// Since CI requires to have default values for dependency images
// (https://github.com/openshift/release/blob/master/ci-operator/step-registry/redhat-appstudio/e2e/redhat-appstudio-e2e-ref.yaml#L15)
// we cannot let these env vars to have identical names in CI as those env vars used in tests
Expand Down Expand Up @@ -507,7 +507,7 @@ func setRequiredEnvVars() error {
requiresSprayProxyRegistering = true
envVarPrefix = "BUILD_SERVICE"
imageTagSuffix = "build-service-image"
testSuiteLabel = "build"
testSuiteLabel = "build-service"
case strings.Contains(jobName, "image-controller"):
requiresSprayProxyRegistering = true
envVarPrefix = "IMAGE_CONTROLLER"
Expand Down Expand Up @@ -545,7 +545,7 @@ func setRequiredEnvVars() error {
https://issues.redhat.com/browse/RHTAPBUGS-992, https://issues.redhat.com/browse/RHTAPBUGS-991, https://issues.redhat.com/browse/RHTAPBUGS-989,
https://issues.redhat.com/browse/RHTAPBUGS-978,https://issues.redhat.com/browse/RHTAPBUGS-956
*/
os.Setenv("E2E_TEST_SUITE_LABEL", "e2e-demo,rhtap-demo,integration-service,ec,build-templates,multi-platform")
os.Setenv("E2E_TEST_SUITE_LABEL", "e2e-demo,konflux,integration-service,ec,build-templates,multi-platform")
} else if strings.Contains(jobName, "release-service-catalog") { // release-service-catalog jobs (pull, rehearsal)
envVarPrefix := "RELEASE_SERVICE"
os.Setenv("E2E_TEST_SUITE_LABEL", "release-pipelines")
Expand Down
2 changes: 1 addition & 1 deletion magefiles/rulesengine/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var InfraDeploymentsTestRulesCatalog = rulesengine.RuleCatalog{
return false
}),
Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error {
rctx.LabelFilter = "e2e-demo,rhtap-demo,spi-suite,remote-secret,integration-service,ec,build-templates,multi-platform"
rctx.LabelFilter = "e2e-demo,konflux-demo,spi-suite,remote-secret,integration-service,ec,build-templates,multi-platform"
return ExecuteTestAction(rctx)
})}},

Expand Down
7 changes: 3 additions & 4 deletions magefiles/rulesengine/repos/infra_deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import "github.com/konflux-ci/e2e-tests/magefiles/rulesengine"
var InfraDeploymentsTestRulesCatalog = rulesengine.RuleCatalog{
rulesengine.Rule{Name: "Infra Deployments Default Test Execution",
Description: "Run the default test suites which include the demo and components suites.",
Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) bool {
Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) bool {

return rctx.RepoName == "infra-deployments"
}),
Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error {
rctx.LabelFilter = "e2e-demo,rhtap-demo,spi-suite,remote-secret,integration-service,ec,build-templates,multi-platform"
rctx.LabelFilter = "e2e-demo,konflux-demo,spi-suite,remote-secret,integration-service,ec,build-templates,multi-platform"
return ExecuteTestAction(rctx)
})}},

}
}
4 changes: 2 additions & 2 deletions magefiles/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestCleanupQuayReposAndRobots(t *testing.T) {
{Name: "multi-platform/test-old"},
}
preservedRepos := []quay.Repository{
{Name: "rhtap-demo/test-new"},
{Name: "konflux-demo/test-new"},
{Name: "multi-platform/test-new"},
{Name: "other/test-new"},
{Name: "other/test-old"},
Expand All @@ -120,7 +120,7 @@ func TestCleanupQuayReposAndRobots(t *testing.T) {
{Name: "test-org+multi-platformtest-old", Created: time.Now().Add(-25 * time.Hour).Format(timeFormat)},
}
preservedRobots := []quay.RobotAccount{
{Name: "test-org+rhtap-demotest-new", Created: time.Now().Format(timeFormat)},
{Name: "test-org+konflux-demotest-new", Created: time.Now().Format(timeFormat)},
{Name: "test-org+multi-platformtest-new", Created: time.Now().Format(timeFormat)},
{Name: "test-org+othertest-old", Created: time.Now().Add(-25 * time.Hour).Format(timeFormat)},
{Name: "test-org+othertest-new", Created: time.Now().Format(timeFormat)},
Expand Down
4 changes: 2 additions & 2 deletions pkg/framework/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func IntegrationServiceSuiteDescribe(text string, args ...interface{}) bool {
return Describe("[integration-service-suite "+text+"]", args, Ordered)
}

func RhtapDemoSuiteDescribe(args ...interface{}) bool {
return Describe("[rhtap-demo-suite]", args)
func KonfluxDemoSuiteDescribe(args ...interface{}) bool {
return Describe("[konflux-demo-suite]", args)
}

func EnterpriseContractSuiteDescribe(text string, args ...interface{}) bool {
Expand Down
Loading

0 comments on commit 7283698

Please sign in to comment.