Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
anupama2501 committed Nov 8, 2024
1 parent 85c4ac0 commit edafcfb
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
45 changes: 40 additions & 5 deletions tests/v2/validation/pipeline/Jenkinsfile.release.upgrade.local
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ node {
def patchedConfigsDir = "patched-cattle-configs"

def testResultsOut = "results.xml"
def testResultsJSON = "results.json"
def envFile = ".env"
def rancherConfig = "rancher_env.config"
def qaseRun = "testrun"
def testRunConfig = "testrunconfig.yaml"

// rancher
def rancherRepo = scm.getUserRemoteConfigs()[0].getUrl()
Expand Down Expand Up @@ -118,7 +121,8 @@ node {
string(credentialsId: 'RANCHER_VALID_TLS_KEY', variable: 'RANCHER_VALID_TLS_KEY'),
string(credentialsId: 'RANCHER_BYO_TLS_CERT', variable: 'RANCHER_BYO_TLS_CERT'),
string(credentialsId: 'RANCHER_BYO_TLS_KEY', variable: 'RANCHER_BYO_TLS_KEY'),
string(credentialsId: 'RANCHER_LINODE_ACCESSKEY', variable: "RANCHER_LINODE_ACCESSKEY")]) {
string(credentialsId: 'QASE_AUTOMATION_TOKEN', variable: 'QASE_AUTOMATION_TOKEN'),
string(credentialsId: 'RANCHER_LINODE_ACCESSKEY', variable: 'RANCHER_LINODE_ACCESSKEY')]) {
withEnv(paramsMap) {
stage('Checkout') {
deleteDir()
Expand Down Expand Up @@ -172,7 +176,18 @@ node {
stage("Build Environment") {
try {
sh "docker run -v ${validationVolume}:/root --name ${buildTestContainer} -t --env-file ${envFile} " +
"${imageName} sh -c \"${workPath}pipeline/scripts/setup_environment.sh\""
"${imageName} sh -c \"${workPath}pipeline/scripts/setup_environment.sh;${workPath}pipeline/scripts/build_qase_auto_testrun.sh\""

sh "docker cp ${buildTestContainer}:${workPath}${qaseRun} ./"
sh "./${qaseRun} --startRun=true"

if ("${env.QASE_TEST_RUN_ID}" == "null" || "${env.QASE_TEST_RUN_ID}" == "") {
echo "Getting the qase testID"
env.QASE_TEST_RUN_ID = sh (
script: "./yq '.id' ./${testRunConfig}",
returnStdout: true
).trim()
}
} catch(err) {
sh "docker stop ${buildTestContainer}"
sh "docker rm -v ${buildTestContainer}"
Expand Down Expand Up @@ -227,12 +242,16 @@ node {
returnStdout: true
).trim()


jobs["$it-provisioning"] = {
stage("Parallel Provisioning: $it"){
def containerName = "${job_name}${env.BUILD_NUMBER}_$it-provisioning"
try {
echo "Starting provisioning tests."
sh "docker run --volumes-from ${buildTestContainer} --name ${containerName} -t -e CATTLE_TEST_CONFIG=\"${absoluteConfigPath}\" " +
"${imageName} sh -c \"gotestsum --format standard-verbose --packages=\"${testsDir}${testPackage}\" --junitfile ${testResultsOut} -- -tags=validation ${testCase} -timeout=\"60m\" -v\""
"${imageName} sh -c \"gotestsum --format standard-verbose --packages=\"${testsDir}${testPackage}\" --junitfile ${testResultsJSON} -- -tags=validation ${testCase} -timeout=\"60m\" -v\""



dir("./${patchedConfigsDir}") {
sh "docker cp ${containerName}:${rootPath}${configsDir}/$it ."
Expand Down Expand Up @@ -280,7 +299,6 @@ node {
stage('Run preupgrade checks') {
try {
jobs = [:]

configFiles.each {
try {
def configPath = "./${configsDir}/$it"
Expand All @@ -295,6 +313,8 @@ node {
script: "./yq '.testCases.upgradeTestCase' ${configPath}",
returnStdout: true
).trim()

sh "docker cp ${buildTestContainer}:${workPath}${qaseRun} ./"

def goValidationParams = [
string(name: 'TIMEOUT', value: "30m"),
Expand All @@ -304,6 +324,7 @@ node {
string(name: 'TEST_PACKAGE', value: "${testPackage}"),
string(name: 'TAGS', value: "${defaultTag}"),
string(name: 'GOTEST_TESTCASE', value: "${testCase}"),
string(name: 'QASE_TEST_RUN_ID', value: "${env.QASE_TEST_RUN_ID}"),
string(name: 'RKE_VERSION', value: "${env.RKE_VERSION}")
]

Expand All @@ -317,7 +338,9 @@ node {
} catch(err) {
echo "Pre upgrade tests had failures: " + err
}
sh "./${qaseRun} --startRun=false"
}

stage('Upgrade local cluster version') {
try {
def configPath = "./${configsDir}/${localConfigFileName}"
Expand All @@ -333,6 +356,10 @@ node {
returnStdout: true
).trim()

echo "Getting the test run ID in upgrade local cluster"

sh "docker cp ${buildTestContainer}:${workPath}${qaseRun} ./"

def goValidationParams = [
string(name: 'TIMEOUT', value: "2h"),
text(name: 'CONFIG', value: configYaml),
Expand All @@ -341,13 +368,15 @@ node {
string(name: 'TEST_PACKAGE', value: "${testPackage}"),
string(name: 'TAGS', value: "${defaultTag}"),
string(name: 'GOTEST_TESTCASE', value: "${testCase}" ),
string(name: 'QASE_TEST_RUN_ID', value: "${env.QASE_TEST_RUN_ID}"),
string(name: 'RKE_VERSION', value: "${env.RKE_VERSION}")
]

build job: 'go-automation-freeform-job', parameters: goValidationParams
} catch(err) {
echo "Kubernetes upgrade tests had failures: " + err
}
sh "./${qaseRun} --startRun=false"
}
stage('Run postupgrade checks') {
try {
Expand All @@ -368,6 +397,10 @@ node {
returnStdout: true
).trim()

echo "Getting the test run ID in post upgrade checks"

sh "docker cp ${buildTestContainer}:${workPath}${qaseRun} ./"

def goValidationParams = [
string(name: 'TIMEOUT', value: "30m"),
text(name: 'CONFIG', value: configYaml),
Expand All @@ -376,13 +409,15 @@ node {
string(name: 'TEST_PACKAGE', value: "${testPackage}"),
string(name: 'TAGS', value: "${defaultTag}"),
string(name: 'GOTEST_TESTCASE', value: "${testCase}"),
string(name: 'QASE_TEST_RUN_ID', value: "${env.QASE_TEST_RUN_ID}"),
string(name: 'RKE_VERSION', value: "${env.RKE_VERSION}")
]

jobs["$it-postupgrade"] = { build job: 'go-automation-freeform-job', parameters: goValidationParams }
} catch(err) {
echo "Post upgrade $it had failures: " + err
}
sh "./${qaseRun} --startRun=false"
}

parallel jobs
Expand Down Expand Up @@ -453,4 +488,4 @@ node {
} // creds
} // folder properties
} // wrap
} // node
} // node
2 changes: 0 additions & 2 deletions tests/v2/validation/pipeline/qase/testrun/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func main() {
logrus.Error("error writiing test run config: ", err)
}
} else {

testRunConfig, err := readConfigFile()
if err != nil {
logrus.Fatalf("error reporting converting string to int32: %v", err)
Expand All @@ -72,7 +71,6 @@ func createTestRun(client *qase.APIClient, testRunName string) (*qase.IdResponse
fmt.Sprintf("%d", runSourceID): fmt.Sprintf("%d", recurringRunID),
},
}

idResponse, _, err := client.RunsApi.CreateRun(context.TODO(), runCreateBody, qasedefaults.RancherManagerProjectID)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ set -e
cd $(dirname $0)/../../../../../

echo "building qase auto testrun bin"
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o tests/v2/validation/testrun ./tests/v2/validation/pipeline/qase/testrun
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o tests/v2/validation/testrun ./tests/v2/validation/pipeline/qase/testrun

if [ $? -ne 0 ]; then
echo "Failed to build Qase auto testrun binary" >&2
exit 1
else
echo "Successfully built Qase auto testrun binary"
fi

0 comments on commit edafcfb

Please sign in to comment.