Skip to content

Commit 2a73796

Browse files
authored
fix: move the CTS around to prepare for multi-languages support (#82)
1 parent 6b97c36 commit 2a73796

File tree

119 files changed

+1010
-890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+1010
-890
lines changed

doc/CTS.md

Lines changed: 18 additions & 7 deletions

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"build:specs": "./scripts/builds/specs.sh ${0:-all} ${1:-yaml}",
1212
"build": "yarn build:specs && yarn build:clients",
1313
"clean": "rm -rf **/dist **/build **/node_modules",
14-
"cts:generate": "yarn workspace tests start",
15-
"cts:test": "yarn workspace tests test",
14+
"cts:generate": "yarn workspace tests build && ./scripts/multiplexer.sh yarn workspace tests generate ${0:-all} ${1:-all} && yarn workspace tests lint:fix",
15+
"cts:test": "./scripts/multiplexer.sh ./scripts/runCTS.sh ${0:-javascript} all",
1616
"docker:build": "./scripts/docker/build.sh",
1717
"docker:clean": "docker stop dev; docker rm -f dev; docker image rm -f api-clients-automation",
1818
"docker:mount": "./scripts/docker/mount.sh",

scripts/multiplexer.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,26 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1515
# Move to the root (easier to locate other scripts)
1616
cd ${DIR}/..
1717

18-
CMD=$1
19-
LANGUAGE=$2
20-
CLIENT=$3
18+
CMD=${@:1:$#-2} # all arguments but the last 2
19+
LANGUAGE=${@: -2:1} # before last argument
20+
CLIENT=${@: -1} # last argument
2121

2222
if [[ $CMD == "./scripts/playground.sh" ]] && ([[ $LANGUAGE == "all" ]] || [[ $CLIENT == "all" ]]); then
2323
echo "You cannot use 'all' when running the playground, please specify the language and client"
2424

2525
exit 1
2626
fi
2727

28+
if [[ $CMD == "./scripts/runCTS.sh" ]]; then
29+
if [[ $CLIENT == "all" ]]; then
30+
CLIENT=search # dummy client to only run once
31+
else
32+
echo "You must use 'all' clients when testing the CTS, as they all run at the same time"
33+
34+
exit 1
35+
fi
36+
fi
37+
2838
LANGUAGES=()
2939
CLIENTS=()
3040

scripts/runCTS.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Break on non-zero code
4+
set -e
5+
6+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
7+
# Move to the root (easier to locate other scripts)
8+
cd ${DIR}/..
9+
10+
lang=$1
11+
12+
# Run the pre generation script if it exists.
13+
run_cts() {
14+
if [[ $lang == 'javascript' ]]; then
15+
yarn workspace javascript-tests test
16+
elif [[ $lang == 'java' ]]; then
17+
mvn clean compile exec:java -f tests/output/java/pom.xml
18+
fi
19+
}
20+
21+
run_cts

tests/CTS/templates/java/requests.mustache

Whitespace-only changes.

tests/generateCTS.ts

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

tests/output/java/tests/searchRequests.java

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)