Skip to content

Commit 20041ac

Browse files
BillyWooozhizming-zhongjingleizhangKailai-Wang
authored
some minor refactor (#1310)
* minor cleanup * small refactor of ts test * typo * add missing mount file * it makes sense to install nodejs+yarn for both worker and cli docker images. * forth bash execution * fix hardcode names * try again * Wait for node in resume-worker * revert redundant install * add missing jq - must be missed out when merging --------- Co-authored-by: zhizming-zhong <zhiming.zhong@litentry.com> Co-authored-by: ericzhang <jingleizhang@users.noreply.github.com> Co-authored-by: Kailai Wang <Kailai.Wang@hotmail.com>
1 parent ed72e3f commit 20041ac

20 files changed

+68
-71
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,11 @@ jobs:
398398
- test_name: demo-sidechain
399399
- test_name: sidechain-benchmark
400400
# Litentry
401-
- test_name: user-shielding-key
402-
- test_name: resume-worker
403-
- test_name: set-heartbeat-timeout
404-
- test_name: vc-test
405-
- test_name: identity-test
401+
- test_name: lit-user-shielding-key
402+
- test_name: lit-resume-worker
403+
- test_name: lit-set-heartbeat-timeout
404+
- test_name: lit-vc-test
405+
- test_name: lit-identity-test
406406

407407
steps:
408408
- uses: actions/checkout@v3
@@ -441,17 +441,17 @@ jobs:
441441
442442
- name: Integration Test ${{ matrix.test_name }}
443443
timeout-minutes: 30
444-
if: ${{ matrix.test_name != 'resume-worker' }}
444+
if: ${{ matrix.test_name != 'lit-resume-worker' }}
445445
run: |
446446
cd tee-worker/docker
447447
docker-compose -f docker-compose.yml -f ${{ matrix.test_name }}.yml up --no-build --exit-code-from ${{ matrix.test_name }} -- ${{ matrix.test_name }}
448448
449449
- name: Integration Test ${{ matrix.test_name }}
450450
timeout-minutes: 30
451-
if: ${{ matrix.test_name == 'resume-worker' }}
451+
if: ${{ matrix.test_name == 'lit-resume-worker' }}
452452
run: |
453453
cd tee-worker/docker
454-
docker-compose -f docker-compose.yml -f resume-worker.yml up --no-build --exit-code-from resume-worker --attach resume-worker relaychain-alice relaychain-bob integritee-node resume-worker
454+
docker-compose -f docker-compose.yml -f ${{ matrix.test_name }}.yml up --no-build --exit-code-from ${{ matrix.test_name }} --attach ${{ matrix.test_name }} relaychain-alice relaychain-bob integritee-node ${{ matrix.test_name }}
455455
456456
- name: Stop docker containers
457457
run: |

tee-worker/build.Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ FROM ubuntu:20.04 AS runner
8585

8686
RUN apt update && apt install -y libssl-dev iproute2 curl
8787

88+
## ts-tests
89+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash
90+
RUN apt-get install -y nodejs jq
91+
RUN npm install -g yarn
92+
8893

8994
### Deployed CLI client
9095
##################################################
@@ -101,11 +106,6 @@ RUN mkdir ${LOG_DIR}
101106
RUN ldd /usr/local/bin/integritee-cli && \
102107
/usr/local/bin/integritee-cli --version
103108

104-
## ts-tests
105-
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash
106-
RUN apt-get install -y nodejs jq
107-
RUN npm install -g yarn
108-
109109
ENTRYPOINT ["/usr/local/bin/integritee-cli"]
110110

111111

@@ -121,7 +121,6 @@ WORKDIR /usr/local/bin
121121

122122
COPY --from=builder /opt/sgxsdk/lib64 /opt/sgxsdk/lib64
123123
COPY --from=builder /root/work/tee-worker/bin/* ./
124-
COPY --from=builder /root/work/tee-worker/local-setup/worker-config-*.json ./
125124
COPY --from=builder /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu
126125

127126
RUN touch spid.txt key.txt

tee-worker/cli/identity_test.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

tee-worker/cli/set_heartbeat_timeout.sh renamed to tee-worker/cli/lit_set_heartbeat_timeout.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Copyright 2020-2023 Litentry Technologies GmbH.
4+
35
while getopts ":p:A:B:u:W:V:C:" opt; do
46
case $opt in
57
p)

tee-worker/cli/lit_ts_test.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020-2023 Litentry Technologies GmbH.
4+
5+
set -euo pipefail
6+
7+
function usage() {
8+
echo "Usage: $0 <Options>"
9+
echo ""
10+
echo "This is a script for tee-worker ts-test. Current available Options:"
11+
echo " test-identity: "
12+
echo " test-vc: "
13+
echo " test-resuming-worker: "
14+
echo ""
15+
echo "Please try to extend the above list when adding new ts-test."
16+
}
17+
18+
[ $# -ne 1 ] && (usage; exit 1)
19+
TEST=$1
20+
21+
cd /ts-tests
22+
23+
yarn install
24+
yarn run $TEST:staging

tee-worker/cli/user_shielding_key.sh renamed to tee-worker/cli/lit_user_shielding_key.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Copyright 2020-2023 Litentry Technologies GmbH.
4+
35
while getopts ":p:A:B:u:W:V:C:" opt; do
46
case $opt in
57
p)

tee-worker/cli/vc_test.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

tee-worker/docker/vc-test.yml renamed to tee-worker/docker/lit-identity-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
2-
vc-test:
2+
lit-identity-test:
33
image: integritee-cli:dev
4-
container_name: integritee-vc-test
4+
container_name: litentry-identity-test
55
volumes:
66
- ../ts-tests:/ts-tests
77
- ../cli:/usr/local/worker-cli
@@ -19,7 +19,7 @@ services:
1919
networks:
2020
- integritee-test-network
2121
entrypoint:
22-
"/usr/local/worker-cli/vc_test.sh 2>&1"
22+
"bash -c '/usr/local/worker-cli/lit_ts_test.sh test-identity 2>&1' "
2323
restart: "no"
2424
networks:
2525
integritee-test-network:

tee-worker/docker/resume-worker.yml renamed to tee-worker/docker/lit-resume-worker.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
services:
2-
resume-worker:
2+
lit-resume-worker:
33
image: integritee-worker:dev
4-
container_name: integritee-worker
4+
container_name: litentry-worker
55
volumes:
66
- ../ts-tests:/ts-tests
7-
- ../scripts/install_node.sh:/install_node.sh
7+
- ../cli:/usr/local/worker-cli
88
build:
99
context: ..
1010
dockerfile: build.Dockerfile
@@ -14,7 +14,8 @@ services:
1414
condition: service_healthy
1515
networks:
1616
- integritee-test-network
17-
entrypoint: "bash -c '/install_node.sh && cd /ts-tests && yarn install && yarn run test-resuming-worker:staging'"
17+
entrypoint:
18+
"bash -c '/usr/local/worker-cli/lit_ts_test.sh test-resuming-worker 2>&1' "
1819
restart: "no"
1920
networks:
2021
integritee-test-network:

tee-worker/docker/set-heartbeat-timeout.yml renamed to tee-worker/docker/lit-set-heartbeat-timeout.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
2-
set-heartbeat-timeout:
2+
lit-set-heartbeat-timeout:
33
image: integritee-cli:dev
44
container_name: litentry-set-heartbeat-timeout
55
volumes:
@@ -18,7 +18,7 @@ services:
1818
networks:
1919
- integritee-test-network
2020
entrypoint:
21-
"/usr/local/worker-cli/set_heartbeat_timeout.sh -p 9912 -u ws://integritee-node
21+
"/usr/local/worker-cli/lit_set_heartbeat_timeout.sh -p 9912 -u ws://integritee-node
2222
-V wss://integritee-worker-1 -A 2011 -W wss://integritee-worker-2 -B 2012 -C /usr/local/bin/integritee-cli 2>&1"
2323
restart: "no"
2424
networks:

0 commit comments

Comments
 (0)