@@ -14,7 +14,7 @@ SCALETEST_SCENARIO="${SCALETEST_SCENARIO:-}"
14
14
SCALETEST_PROJECT=" ${SCALETEST_PROJECT:- } "
15
15
SCALETEST_PROMETHEUS_REMOTE_WRITE_USER=" ${SCALETEST_PROMETHEUS_REMOTE_WRITE_USER:- } "
16
16
SCALETEST_PROMETHEUS_REMOTE_WRITE_PASSWORD=" ${SCALETEST_PROMETHEUS_REMOTE_WRITE_PASSWORD:- } "
17
- SCALETEST_SKIP_CLEANUP=" ${SCALETEST_SKIP_CLEANUP:- } "
17
+ SCALETEST_SKIP_CLEANUP=" ${SCALETEST_SKIP_CLEANUP:- 0 } "
18
18
19
19
script_name=$( basename " $0 " )
20
20
args=" $( getopt -o " " -l dry-run,help,name:,num-workspaces:,project:,scenario:,skip-cleanup -- " $@ " ) "
@@ -26,7 +26,7 @@ while true; do
26
26
shift
27
27
;;
28
28
--help)
29
- echo " Usage: $script_name --name <name> --project <project> [ --num-workspaces <num-workspaces>] [ --scenario <scenario>] [--dry-run]"
29
+ echo " Usage: $script_name --name <name> --project <project> --num-workspaces <num-workspaces> --scenario <scenario> [--dry-run] [--skip-cleanup ]"
30
30
exit 1
31
31
;;
32
32
--name)
@@ -99,11 +99,17 @@ if [[ ! -f "${SCALETEST_SCENARIO_VARS}" ]]; then
99
99
exit 1
100
100
fi
101
101
102
- if [[ " ${SCALETEST_SKIP_CLEANUP} " == " true " ]]; then
102
+ if [[ " ${SCALETEST_SKIP_CLEANUP} " == 1 ]]; then
103
103
log " WARNING: you told me to not clean up after myself, so this is now your job!"
104
104
fi
105
105
106
106
CONFIG_DIR=" ${PROJECT_ROOT} /scaletest/.coderv2"
107
+ if [[ -d " ${CONFIG_DIR} " ]] && files=$( ls -qAH -- " ${CONFIG_DIR} " ) && [[ -z " $files " ]]; then
108
+ echo " Cleaning previous configuration"
109
+ maybedryrun " $DRY_RUN " rm -fv " ${CONFIG_DIR} /*"
110
+ fi
111
+ maybedryrun " $DRY_RUN " mkdir -p " ${CONFIG_DIR} "
112
+
107
113
SCALETEST_SCENARIO_VARS=" ${PROJECT_ROOT} /scaletest/terraform/scenario-${SCALETEST_SCENARIO} .tfvars"
108
114
SCALETEST_SECRETS=" ${PROJECT_ROOT} /scaletest/terraform/secrets.tfvars"
109
115
SCALETEST_SECRETS_TEMPLATE=" ${PROJECT_ROOT} /scaletest/terraform/secrets.tfvars.tpl"
@@ -128,7 +134,7 @@ if [[ "${DRY_RUN}" != 1 ]]; then
128
134
else
129
135
SCALETEST_CODER_URL=" http://coder.dryrun.local:3000"
130
136
fi
131
- KUBECONFIG=" ${PWD} /.coderv2/${SCALETEST_NAME} -cluster.kubeconfig"
137
+ KUBECONFIG=" ${PROJECT_ROOT} /scaletest /.coderv2/${SCALETEST_NAME} -cluster.kubeconfig"
132
138
echo " Waiting for Coder deployment at ${SCALETEST_CODER_URL} to become ready"
133
139
maybedryrun " $DRY_RUN " kubectl --kubeconfig=" ${KUBECONFIG} " -n " coder-${SCALETEST_NAME} " rollout status deployment/coder
134
140
@@ -171,7 +177,7 @@ maybedryrun "$DRY_RUN" curl --silent --fail --output "${SCALETEST_NAME}-heap.ppr
171
177
maybedryrun " $DRY_RUN " curl --silent --fail --output " ${SCALETEST_NAME} -goroutine.pprof.gz" http://localhost:6061/debug/pprof/goroutine
172
178
maybedryrun " $DRY_RUN " kill $pfpid
173
179
174
- if [[ " ${SCALETEST_SKIP_CLEANUP} " == " true " ]]; then
180
+ if [[ " ${SCALETEST_SKIP_CLEANUP} " == 1 ]]; then
175
181
echo " Leaving resources up for you to inspect."
176
182
echo " Please don't forget to clean up afterwards:"
177
183
echo " cd terraform && terraform destroy --var-file=${SCALETEST_SCENARIO_VARS} --var-file=${SCALETEST_SECRETS} --auto-approve"
0 commit comments