Skip to content

Commit ec18a18

Browse files
committed
simple workflows + testing infra
Signed-off-by: Kostas Kyrimis <[email protected]>
1 parent 8d28c55 commit ec18a18

File tree

8 files changed

+112
-4
lines changed

8 files changed

+112
-4
lines changed

.github/actions/regression-tests/action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ inputs:
3131
epoll:
3232
required: false
3333
type: string
34+
df-arg:
35+
required: false
36+
type: string
3437

3538
runs:
3639
using: "composite"
@@ -55,14 +58,18 @@ runs:
5558
export ROOT_DIR="${GITHUB_WORKSPACE}/tests/dragonfly/valkey_search"
5659
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 # to crash on errors
5760
61+
if [[ "${{inputs.df-arg}}" == 'epoll' ]]; then
62+
export DF_ARG="--df ${{inputs.df-arg}}"
63+
fi
64+
5865
if [[ "${{inputs.epoll}}" == 'epoll' ]]; then
5966
export FILTER="${{inputs.filter}} and not exclude_epoll"
6067
# Run only replication tests with epoll
61-
timeout 80m pytest -m "$FILTER" --durations=10 --timeout=300 --color=yes --json-report --json-report-file=report.json dragonfly --df force_epoll=true --log-cli-level=INFO || code=$?
68+
timeout 80m pytest -m "$FILTER" $DF_ARG --durations=10 --timeout=300 --color=yes --json-report --json-report-file=report.json dragonfly --df force_epoll=true --df --log-cli-level=INFO || code=$?
6269
else
6370
export FILTER="${{inputs.filter}}"
6471
# Run only replication tests with iouring
65-
timeout 80m pytest -m "$FILTER" --durations=10 --timeout=300 --color=yes --json-report --json-report-file=report.json dragonfly --log-cli-level=INFO || code=$?
72+
timeout 80m pytest -m "$FILTER" $DF_ARG --durations=10 --timeout=300 --color=yes --json-report --json-report-file=report.json dragonfly --log-cli-level=INFO || code=$?
6673
fi
6774
6875
# timeout returns 124 if we exceeded the timeout duration
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: RegTests IoLoopV2
2+
3+
# Manually triggered only
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
strategy:
10+
matrix:
11+
# Test of these containers
12+
container: ["ubuntu-dev:20"]
13+
proactor: [Uring]
14+
build-type: [Debug, Release]
15+
runner: [ubuntu-latest, [self-hosted, linux, ARM64]]
16+
17+
runs-on: ${{ matrix.runner }}
18+
19+
container:
20+
image: ghcr.io/romange/${{ matrix.container }}
21+
options: --security-opt seccomp=unconfined --sysctl "net.ipv6.conf.all.disable_ipv6=0"
22+
volumes:
23+
- /var/crash:/var/crash
24+
25+
steps:
26+
- uses: actions/checkout@v5
27+
with:
28+
submodules: true
29+
30+
- name: Print environment info
31+
run: |
32+
cat /proc/cpuinfo
33+
ulimit -a
34+
env
35+
36+
- name: Configure & Build
37+
run: |
38+
# -no-pie to disable address randomization so we could symbolize stacktraces
39+
cmake -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -GNinja \
40+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DPRINT_STACKTRACES_ON_SIGNAL=ON \
41+
-DCMAKE_CXX_FLAGS=-no-pie -DHELIO_STACK_CHECK:STRING=4096
42+
43+
cd ${GITHUB_WORKSPACE}/build && ninja dragonfly
44+
pwd
45+
ls -l ..
46+
47+
- name: Run regression tests action
48+
uses: ./.github/actions/regression-tests
49+
with:
50+
dfly-executable: dragonfly
51+
gspace-secret: ${{ secrets.GSPACES_BOT_DF_BUILD }}
52+
build-folder-name: build
53+
filter: ${{ matrix.build-type == 'Release' && 'not debug_only and not tls' || 'not opt_only and not tls' }}
54+
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY }}
55+
aws-secret-access-key: ${{ secrets.AWS_S3_ACCESS_SECRET }}
56+
s3-bucket: ${{ secrets.S3_REGTEST_BUCKET }}
57+
df-arg: "expiremental_io_loop_v2"
58+
59+
- name: Upload logs on failure
60+
if: failure()
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: logs
64+
path: /tmp/failed/*
65+
66+
- name: Copy binary on a self hosted runner
67+
if: failure()
68+
run: |
69+
# We must use sh syntax.
70+
if [ "$RUNNER_ENVIRONMENT" = "self-hosted" ]; then
71+
cd ${GITHUB_WORKSPACE}/build
72+
timestamp=$(date +%Y-%m-%d_%H:%M:%S)
73+
mv ./dragonfly /var/crash/dragonfy_${timestamp}
74+
fi
75+
76+
lint-test-chart:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v5
80+
- uses: ./.github/actions/lint-test-chart

tests/dragonfly/connection_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ async def check_stats():
875875
await check_stats()
876876

877877

878+
@pytest.mark.tls
878879
async def test_reject_non_tls_connections_on_tls(with_tls_server_args, df_factory):
879880
server: DflyInstance = df_factory.create(
880881
no_tls_on_admin_port="true",
@@ -894,6 +895,7 @@ async def test_reject_non_tls_connections_on_tls(with_tls_server_args, df_factor
894895
assert await client.dbsize() == 0
895896

896897

898+
@pytest.mark.tls
897899
async def test_tls_insecure(with_ca_tls_server_args, with_tls_client_args, df_factory):
898900
server = df_factory.create(port=BASE_PORT, **with_ca_tls_server_args)
899901
server.start()
@@ -902,6 +904,7 @@ async def test_tls_insecure(with_ca_tls_server_args, with_tls_client_args, df_fa
902904
assert await client.dbsize() == 0
903905

904906

907+
@pytest.mark.tls
905908
async def test_tls_full_auth(with_ca_tls_server_args, with_ca_tls_client_args, df_factory):
906909
server = df_factory.create(port=BASE_PORT, **with_ca_tls_server_args)
907910
server.start()
@@ -910,6 +913,7 @@ async def test_tls_full_auth(with_ca_tls_server_args, with_ca_tls_client_args, d
910913
assert await client.dbsize() == 0
911914

912915

916+
@pytest.mark.tls
913917
async def test_tls_reject(
914918
with_ca_tls_server_args, with_tls_client_args, df_factory: DflyInstanceFactory
915919
):
@@ -1094,6 +1098,7 @@ async def client_pause():
10941098
await all
10951099

10961100

1101+
@pytest.mark.tls
10971102
async def test_tls_when_read_write_is_interleaved(
10981103
with_ca_tls_server_args, with_ca_tls_client_args, df_factory
10991104
):
@@ -1371,6 +1376,7 @@ async def test_client_detached_crash(df_factory):
13711376
server.stop()
13721377

13731378

1379+
@pytest.mark.tls
13741380
async def test_tls_client_kill_preemption(
13751381
with_ca_tls_server_args, with_ca_tls_client_args, df_factory
13761382
):

tests/dragonfly/instance.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,6 @@ def create(self, existing_port=None, path=None, version=100, **kwargs) -> DflyIn
436436
if version >= 1.26:
437437
args.setdefault("fiber_safety_margin=4096")
438438

439-
args.setdefault("expiremental_io_loop_v2=true")
440-
441439
for k, v in args.items():
442440
args[k] = v.format(**self.params.env) if isinstance(v, str) else v
443441

tests/dragonfly/pymemcached_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def test_expiration(memcached_client: MCClient):
176176
assert memcached_client.get("key3") == None
177177

178178

179+
@pytest.mark.tls
179180
@dfly_args(DEFAULT_ARGS)
180181
def test_memcached_tls_no_requirepass(df_factory, with_tls_server_args, with_tls_ca_cert_args):
181182
"""

tests/dragonfly/replication_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@ async def test_take_over_timeout(df_factory, df_seeder_factory):
14471447
replication_cases = [(8, 8)]
14481448

14491449

1450+
@pytest.mark.tls
14501451
@pytest.mark.parametrize("t_master, t_replica", replication_cases)
14511452
async def test_no_tls_on_admin_port(
14521453
df_factory: DflyInstanceFactory,
@@ -1495,6 +1496,7 @@ async def test_no_tls_on_admin_port(
14951496
replication_cases = [(8, 8, False), (8, 8, True)]
14961497

14971498

1499+
@pytest.mark.tls
14981500
@pytest.mark.parametrize("t_master, t_replica, test_admin_port", replication_cases)
14991501
async def test_tls_replication(
15001502
df_factory,
@@ -1559,6 +1561,7 @@ async def test_tls_replication(
15591561
await proxy.close(proxy_task)
15601562

15611563

1564+
@pytest.mark.tls
15621565
@dfly_args({"proactor_threads": 2})
15631566
async def test_tls_replication_without_ca(
15641567
df_factory,

tests/dragonfly/tls_conf_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44
from .instance import DflyStartException
55

66

7+
@pytest.mark.tls
78
async def test_tls_no_auth(df_factory, with_tls_server_args):
89
# Needs some authentication
910
server = df_factory.create(**with_tls_server_args)
1011
with pytest.raises(DflyStartException):
1112
server.start()
1213

1314

15+
@pytest.mark.tls
1416
async def test_tls_no_key(df_factory):
1517
# Needs a private key and certificate.
1618
server = df_factory.create(tls=None, requirepass="XXX")
1719
with pytest.raises(DflyStartException):
1820
server.start()
1921

2022

23+
@pytest.mark.tls
2124
async def test_tls_password(df_factory, with_tls_server_args, with_tls_ca_cert_args):
2225
with df_factory.create(requirepass="XXX", **with_tls_server_args) as server:
2326
async with server.client(
@@ -26,6 +29,7 @@ async def test_tls_password(df_factory, with_tls_server_args, with_tls_ca_cert_a
2629
await client.ping()
2730

2831

32+
@pytest.mark.tls
2933
async def test_tls_client_certs(
3034
df_factory, with_ca_tls_server_args, with_tls_client_args, with_tls_ca_cert_args
3135
):
@@ -36,24 +40,28 @@ async def test_tls_client_certs(
3640
await client.ping()
3741

3842

43+
@pytest.mark.tls
3944
async def test_client_tls_no_auth(df_factory):
4045
server = df_factory.create(tls_replication=None)
4146
with pytest.raises(DflyStartException):
4247
server.start()
4348

4449

50+
@pytest.mark.tls
4551
async def test_client_tls_password(df_factory):
4652
with df_factory.create(tls_replication=None, masterauth="XXX"):
4753
pass
4854

4955

56+
@pytest.mark.tls
5057
async def test_client_tls_cert(df_factory, with_tls_server_args):
5158
key_args = with_tls_server_args.copy()
5259
key_args.pop("tls")
5360
with df_factory.create(tls_replication=None, **key_args):
5461
pass
5562

5663

64+
@pytest.mark.tls
5765
async def test_config_enable_tls_with_ca_dir(
5866
df_factory, with_ca_dir_tls_server_args, with_tls_client_args
5967
):
@@ -67,6 +75,7 @@ async def test_config_enable_tls_with_ca_dir(
6775
assert res == "44"
6876

6977

78+
@pytest.mark.tls
7079
async def test_config_update_tls_certs(
7180
df_factory, with_tls_server_args, with_tls_ca_cert_args, tmp_dir
7281
):
@@ -112,6 +121,7 @@ async def test_config_update_tls_certs(
112121
await client.ping()
113122

114123

124+
@pytest.mark.tls
115125
async def test_config_enable_tls(
116126
df_factory, with_ca_tls_server_args, with_tls_client_args, with_tls_ca_cert_args
117127
):
@@ -152,6 +162,7 @@ async def test_config_enable_tls(
152162
await client_tls.ping()
153163

154164

165+
@pytest.mark.tls
155166
async def test_config_disable_tls(
156167
df_factory, with_ca_tls_server_args, with_tls_client_args, with_tls_ca_cert_args
157168
):

tests/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ markers =
1919
# Tests that should only run in debug mode because release builds are fast enough
2020
# for their assertions to hold. They never run on release build.
2121
debug_only: mark tests that should run only in debug mode
22+
#tls tests
23+
tls: tests specific to tls
2224
filterwarnings =
2325
ignore::DeprecationWarning

0 commit comments

Comments
 (0)