Skip to content

Commit 9445a62

Browse files
authored
Prepare for testmo retries (#8475)
1 parent dc4ea7f commit 9445a62

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

.github/actions/test_ya/action.yml

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,34 @@ runs:
8383
mkdir -p $PUBLIC_DIR
8484
8585
echo "LAST_JUNIT_REPORT_XML=$PUBLIC_DIR/last_junit.xml" >> $GITHUB_ENV
86-
echo "TESTMO_URL=${{ inputs.testman_url }}" >> $GITHUB_ENV
86+
export TESTMO_URL=${{ inputs.testman_url }}
87+
echo "TESTMO_URL=$TESTMO_URL" >> $GITHUB_ENV
8788
echo "SUMMARY_LINKS=$PUBLIC_DIR/summary_links.txt" >> $GITHUB_ENV
8889
echo "BUILD_PRESET=${{ inputs.build_preset }}" >> $GITHUB_ENV
8990
9091
python3 -m pip install ydb ydb[yc] codeowners
9192
93+
if [ ${{ inputs.testman_token }} ]; then
94+
TESTMO_PROXY_ADDR=127.0.0.1:8888
95+
openssl req -x509 -newkey rsa:2048 \
96+
-keyout $TMP_DIR/key.pem -out $TMP_DIR/cert.pem \
97+
-sha256 -days 1 -nodes -subj "/CN=127.0.0.1"
98+
99+
TESTMO_TOKEN=${{ inputs.testman_token }} ./ydb/ci/testmo-proxy/testmo-proxy.py -l $TESTMO_PROXY_ADDR \
100+
--cert-file "$TMP_DIR/cert.pem" \
101+
--cert-key "$TMP_DIR/key.pem" \
102+
--target-timeout 3,60 \
103+
--max-request-time 200 \
104+
"$TESTMO_URL" > $PUBLIC_DIR/testmo_proxy.log 2>&1 &
105+
106+
TESTMO_PROXY_PID=$!
107+
echo "TESTMO_PROXY_ADDR=$TESTMO_PROXY_ADDR" >> $GITHUB_ENV
108+
echo "TESTMO_PROXY_PID=$TESTMO_PROXY_PID" >> $GITHUB_ENV
109+
110+
# testmo rejects self-signed cert without this setting
111+
echo "NODE_TLS_REJECT_UNAUTHORIZED=0" >> $GITHUB_ENV
112+
fi
113+
92114
- name: ya build and test
93115
id: build
94116
shell: bash
@@ -260,7 +282,7 @@ runs:
260282
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:resources:add-link --name build --url "$TESTMO_RUN_URL" --resources testmo.json
261283
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:resources:add-field --name git-sha --type string --value "${GITHUB_SHA:0:7}" --resources testmo.json
262284
TESTMO_RUN_ID=$(
263-
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{ inputs.testman_project_id }} \
285+
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:create --instance "https://$TESTMO_PROXY_ADDR" --project-id ${{ inputs.testman_project_id }} \
264286
--name "$TESTMO_RUN_NAME" --source "$TESTMO_SOURCE" --resources testmo.json \
265287
--tags "$TESTMO_BRANCH_TAG" --tags "$TESTMO_EXTRA_TAG"
266288
)
@@ -373,29 +395,12 @@ runs:
373395
.github/scripts/tests/split-junit.py -o "$TESTMO_JUNIT_REPORT_PARTS" "$CURRENT_JUNIT_XML_PATH"
374396
# archive unitest reports (transformed)
375397
tar -C $TESTMO_JUNIT_REPORT_PARTS/.. -czf $PUBLIC_DIR/junit_parts.xml.tar.gz $(basename $TESTMO_JUNIT_REPORT_PARTS)
376-
377-
TESTMO_PROXY_ADDR=127.0.0.1:8888
378-
379-
openssl req -x509 -newkey rsa:2048 \
380-
-keyout $TMP_DIR/key.pem -out $TMP_DIR/cert.pem \
381-
-sha256 -days 1 -nodes -subj "/CN=127.0.0.1"
382-
383-
TESTMO_TOKEN=${{ inputs.testman_token }} ./ydb/ci/testmo-proxy/testmo-proxy.py -l $TESTMO_PROXY_ADDR \
384-
--cert-file "$TMP_DIR/cert.pem" \
385-
--cert-key "$TMP_DIR/key.pem" \
386-
--target-timeout 3,10 \
387-
--max-request-time 55 \
388-
"$TESTMO_URL" &
389-
390-
testmo_proxy_pid=$!
391398

392-
TESTMO_TOKEN=${{ inputs.testman_token }} NODE_TLS_REJECT_UNAUTHORIZED=0 testmo automation:run:submit-thread \
399+
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:submit-thread \
393400
--instance "https://$TESTMO_PROXY_ADDR" --run-id "$TESTMO_RUN_ID" \
394401
--results "$TESTMO_JUNIT_REPORT_PARTS/*.xml"
395-
396-
kill $testmo_proxy_pid
397402

398-
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:complete --instance "$TESTMO_URL" --run-id $TESTMO_RUN_ID
403+
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:complete --instance "https://$TESTMO_PROXY_ADDR" --run-id $TESTMO_RUN_ID || true
399404
echo "runid=" >> $GITHUB_OUTPUT
400405
fi
401406

@@ -435,7 +440,10 @@ runs:
435440
shell: bash
436441
run: |
437442
if [ ${{ steps.build.outputs.runid }} ]; then
438-
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:complete --instance "$TESTMO_URL" --run-id ${{ steps.build.outputs.runid }}
443+
TESTMO_TOKEN=${{ inputs.testman_token }} testmo automation:run:complete --instance "https://$TESTMO_PROXY_ADDR" --run-id ${{ steps.build.outputs.runid }} || true
444+
fi
445+
if [ ${{ inputs.testman_token }} ]; then
446+
kill $TESTMO_PROXY_PID
439447
fi
440448
- name: analyze tests results
441449
shell: bash

ydb/ci/testmo-proxy/testmo-proxy.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ def do_GET(self):
8383
def do_POST(self):
8484
self._proxy_request("POST")
8585

86+
def do_PUT(self):
87+
self._proxy_request("PUT")
88+
89+
def do_DELETE(self):
90+
self._proxy_request("DELETE")
91+
8692

8793
def main():
8894
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)