Skip to content

Commit 5ae1dde

Browse files
committed
integration tests
1 parent a1453a8 commit 5ae1dde

2 files changed

Lines changed: 169 additions & 1 deletion

File tree

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: Bun and Deno Integration Tests
2+
3+
on:
4+
push:
5+
branches: [trunk]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
actions: read
11+
checks: write
12+
13+
jobs:
14+
integration-tests:
15+
name: Integration (${{ matrix.RUNTIME }}, Cassandra ${{ matrix.SERVER_VERSION }})
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
RUNTIME: ["bun", "deno"]
20+
SERVER_VERSION: ["3.11", "4.0", "4.1", "5.0"] # Cassandra minor versions
21+
fail-fast: false
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
# ---- Python for ccm ----
28+
- name: Set up Python 3.9.16
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.9.16"
32+
33+
- name: Install ccm
34+
run: |
35+
python -m pip install --upgrade pip
36+
git clone --depth 1 --single-branch -b cassandra-test https://github.com/apache/cassandra-ccm.git
37+
cd cassandra-ccm
38+
pip install -r requirements.txt
39+
./setup.py install
40+
41+
# ---- Install required Zulu JDKs (8/11/17) and capture their homes ----
42+
- name: Install Zulu 11
43+
id: z11
44+
uses: actions/setup-java@v5
45+
with:
46+
distribution: zulu
47+
java-version: "11"
48+
49+
- name: Install Zulu 17
50+
id: z17
51+
uses: actions/setup-java@v5
52+
with:
53+
distribution: zulu
54+
java-version: "17"
55+
56+
- name: Install Zulu 8
57+
id: z8
58+
uses: actions/setup-java@v5
59+
with:
60+
distribution: zulu
61+
java-version: "8"
62+
63+
- name: Export JAVA*_HOME variables
64+
run: |
65+
echo "JAVA8_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
66+
echo "JAVA11_HOME=${{ steps.z11.outputs.path }}" >> "$GITHUB_ENV"
67+
echo "JAVA17_HOME=${{ steps.z17.outputs.path }}" >> "$GITHUB_ENV"
68+
echo "JAVA_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
69+
echo "CCM_UPDATE_PID_DEFAULT_TIMEOUT=120" >> "$GITHUB_ENV"
70+
71+
- name: Generate SSL certificates
72+
run: |
73+
mkdir -p /home/runner/workspace/tools/ccm/ssl/
74+
cd /home/runner/workspace/tools/ccm/ssl/
75+
keytool -genkey \
76+
-keyalg RSA \
77+
-alias cassandra \
78+
-keystore keystore.jks \
79+
-storepass cassandra \
80+
-keypass cassandra \
81+
-validity 364635 \
82+
-dname "CN=Jane He, OU=TE, O=ASF, L=Santa Clara, ST=CA, C=TE"
83+
keytool -export \
84+
-alias cassandra \
85+
-file cassandra.crt \
86+
-keystore keystore.jks \
87+
-storepass cassandra
88+
openssl x509 \
89+
-inform der \
90+
-in cassandra.crt \
91+
-out cassandra.pem
92+
keytool -genkeypair \
93+
-keyalg RSA \
94+
-alias client \
95+
-keystore truststore.jks \
96+
-storepass cassandra \
97+
-keypass cassandra \
98+
-validity 364635 \
99+
-dname "CN=Philip Thompson, OU=TE, O=DataStax, L=Santa Clara, ST=CA, C=TE"
100+
keytool -importkeystore \
101+
-srckeystore truststore.jks \
102+
-destkeystore client.p12 \
103+
-srcstorepass cassandra \
104+
-deststorepass cassandra \
105+
-deststoretype PKCS12
106+
openssl pkcs12 \
107+
-in client.p12 \
108+
-passin pass:cassandra \
109+
-nokeys \
110+
-out client_cert.pem -legacy
111+
openssl pkcs12 \
112+
-in client.p12 \
113+
-passin pass:cassandra \
114+
-nodes \
115+
-nocerts \
116+
-out client_key.pem -legacy
117+
118+
- name: Install Simulacron
119+
run: |
120+
wget https://github.com/datastax/simulacron/releases/download/0.12.0/simulacron-standalone-0.12.0.jar -O /home/runner/simulacron.jar
121+
122+
# ---- Set up the runtime under test ----
123+
- name: Set up Bun
124+
if: matrix.RUNTIME == 'bun'
125+
uses: oven-sh/setup-bun@v2
126+
with:
127+
bun-version: 1.x
128+
129+
- name: Set up Deno
130+
if: matrix.RUNTIME == 'deno'
131+
uses: denoland/setup-deno@v2
132+
with:
133+
deno-version: v2.x
134+
135+
- name: Resolve Cassandra latest patch version
136+
env:
137+
SERVER_VERSION: ${{ matrix.SERVER_VERSION }}
138+
run: |
139+
PATCH_SERVER_VERSION=$(
140+
curl -s https://downloads.apache.org/cassandra/ \
141+
| grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=)' \
142+
| sort -rV \
143+
| uniq -w 3 \
144+
| grep "^${SERVER_VERSION}\."
145+
)
146+
echo "Resolved Cassandra ${SERVER_VERSION}.x -> ${PATCH_SERVER_VERSION}"
147+
echo "CCM_VERSION=$PATCH_SERVER_VERSION" >> "$GITHUB_ENV"
148+
149+
- name: Print environment
150+
run: printenv | sort
151+
152+
- name: Pre-download Cassandra distribution
153+
run: |
154+
ccm create predownload -v $CCM_VERSION
155+
ccm remove
156+
157+
- name: Run integration tests (${{ matrix.RUNTIME }})
158+
run: |
159+
if [ "${{ matrix.RUNTIME }}" = "bun" ]; then
160+
# Bun has full CommonJS support, so mocha runs unchanged.
161+
bun install
162+
bunx mocha test/integration/short --recursive --exit -R spec -t 5000
163+
else
164+
# --allow-scripts builds the kerberos native addon; --unstable-detect-cjs
165+
# makes Deno load the CommonJS driver and tests correctly.
166+
deno install --allow-scripts=npm:kerberos
167+
deno run -A --unstable-detect-cjs npm:mocha test/integration/short --recursive --exit -R spec -t 5000
168+
fi

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- uses: actions/checkout@v4
6565
- uses: denoland/setup-deno@v2
6666
with:
67-
deno-version: 2.x
67+
deno-version: v2.x
6868
# --allow-scripts runs lifecycle scripts so the kerberos prebuild is fetched.
6969
- run: deno install --allow-scripts=npm:kerberos
7070
- run: deno run -A --unstable-detect-cjs npm:mocha@10.8.2 test/unit --recursive -R spec -t 5000

0 commit comments

Comments
 (0)