Skip to content
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

feat(KONFLUX-2547): Make it possible to configure BuildPipelineSelector #1111

Closed
wants to merge 7 commits into from
246 changes: 204 additions & 42 deletions cmd/loadTests.go

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions pkg/clients/github/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"strings"
"time"

. "github.com/onsi/gomega"

"github.com/google/go-github/v44/github"
"github.com/redhat-appstudio/e2e-tests/pkg/utils"
)

func (g *Github) DeleteRef(repository, branchName string) error {
Expand Down Expand Up @@ -39,12 +38,19 @@ func (g *Github) CreateRef(repository, baseBranchName, sha, newBranchName string
if err != nil {
return fmt.Errorf("error when creating a new branch '%s' for the repo '%s': %+v", newBranchName, repository, err)
}
Eventually(func(gomega Gomega) {
err = utils.WaitUntilWithInterval(func() (done bool, err error) {
exist, err := g.ExistsRef(repository, newBranchName)
gomega.Expect((err)).NotTo(HaveOccurred())
gomega.Expect(exist).To(BeTrue())

}, 2*time.Minute, 2*time.Second).Should(Succeed()) //Wait for the branch to actually exist
if err != nil {
return false, err
}
if exist && err == nil {
return exist, err
}
return false, nil
}, 2*time.Second, 2*time.Minute) //Wait for the branch to actually exist
if err != nil {
return fmt.Errorf("Failed waiting for repo being done: %+v", err)
}
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions tests/load-tests/ci-scripts/collect-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ find "$output_dir" -type f -name '*.pprof' -exec cp -vf {} "${ARTIFACT_DIR}" \;
pipelineruns_json=$ARTIFACT_DIR/pipelineruns.json
taskruns_json=$ARTIFACT_DIR/taskruns.json
pods_json=$ARTIFACT_DIR/pods.json
buildpipelineselectors_json=$ARTIFACT_DIR/buildpipelineselectors.json

application_timestamps=$ARTIFACT_DIR/applications.appstudio.redhat.com_timestamps
application_timestamps_csv=${application_timestamps}.csv
Expand Down Expand Up @@ -182,6 +183,9 @@ jq -r ".items[] | .spec.nodeName" "$pods_json" | sort | uniq -c | sed -e 's,\s\+
echo "Node;Pods" >"$task_pods_distribution_csv"
jq -r '.items[] | select(.metadata.labels."appstudio.openshift.io/application" != null).spec.nodeName' "$pods_json" | sort | uniq -c | sed -e 's,\s\+\([0-9]\+\)\s\+\(.*\),\2;\1,g' >>"$task_pods_distribution_csv"

## Record BuildPipelineSelectors
oc get BuildPipelineSelectors -A -o json >"$buildpipelineselectors_json"

## Tekton Artifact Performance Analysis
tapa_dir=./tapa.git

Expand Down
9 changes: 7 additions & 2 deletions tests/load-tests/ci-scripts/setup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ if [ "${TEKTON_PERF_ENABLE_CPU_PROFILING:-}" == "true" ] || [ "${TEKTON_PERF_ENA
oc patch -n tekton-results cm tekton-results-config-observability --type=json -p='[{"op": "add", "path": "/data/profiling.enable", "value": "true"}]'
fi

## Patch Build Service github secret
echo "Patching Build Service github token"
oc patch -n build-service secret pipelines-as-code-secret --type=json -p='[{"op": "add", "path": "/data/password", "value": "'"$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github-token | tr -d "\n" | base64 -w0)"'"}]'
oc rollout restart deployment -n build-service
oc rollout status deployment -n build-service -w

## Patch HAS github secret
echo "Patching HAS github tokens"
oc patch -n application-service secret has-github-token --type=json -p='[{"op": "add", "path": "/data/tokens", "value": "'"$(base64 -w0 </usr/local/ci-secrets/redhat-appstudio-load-test/github_accounts)"'"}]'
oc patch -n application-service secret has-github-token -p '{"data": {"token": null}}'
oc patch -n application-service secret has-github-token --type=json -p='[{"op": "add", "path": "/data/tokens", "value": "'"$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github_accounts | tr -d "\n" | base64 -w0)"'"},{"op": "add", "path": "/data/token", "value": "'"$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github-token | tr -d "\n" | base64 -w0)"'"},{"op": "add", "path": "/data/cdq-token", "value": "'"$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github-token | tr -d "\n" | base64 -w0)"'"}]'
oc rollout restart deployment -n application-service
oc rollout status deployment -n application-service -w

Expand Down
1 change: 1 addition & 0 deletions tests/load-tests/run-max-concurrency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ load_test() {
rm -rvf "$output_dir/load-test.log"
go run loadtest.go \
--component-repo "${COMPONENT_REPO:-https://github.com/nodeshift-starters/devfile-sample.git}" \
--component-repo-revision "${COMPONENT_REPO_REVISION:-main}" \
--username "$USER_PREFIX-$index" \
--users 1 \
-w="${WAIT_PIPELINES:-true}" \
Expand Down
2 changes: 2 additions & 0 deletions tests/load-tests/run-stage.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
go run loadtest.go \
--component-repo "${COMPONENT_REPO:-https://github.com/devfile-samples/devfile-sample-code-with-quarkus}" \
--component-repo-revision "${COMPONENT_REPO_REVISION:-main}" \
--build-pipeline-selector-bundle "${BUILD_PIPELINE_SELECTOR_BUNDLE:-}" \
--username "$USER_PREFIX" \
--users "${USERS_PER_THREAD:-2}" \
--test-scenario-git-url "${TEST_SCENARIO_GIT_URL:-https://github.com/konflux-ci/integration-examples.git}" \
Expand Down
2 changes: 2 additions & 0 deletions tests/load-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ else
## To enable progress bar , add `--enable-progress-bars` in [OPTIONS]
go run loadtest.go \
--component-repo "${COMPONENT_REPO:-https://github.com/devfile-samples/devfile-sample-code-with-quarkus}" \
--component-repo-revision "${COMPONENT_REPO_REVISION:-main}" \
--build-pipeline-selector-bundle "${BUILD_PIPELINE_SELECTOR_BUNDLE:-}" \
--username "$USER_PREFIX" \
--users "${USERS_PER_THREAD:-50}" \
--test-scenario-git-url "${TEST_SCENARIO_GIT_URL:-https://github.com/konflux-ci/integration-examples.git}" \
Expand Down
Loading