Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: E2E Tests

on:
push:
branches: ["*"]
pull_request:
branches: ["*"]

jobs:
e2e-tests:
runs-on: ubuntu-24.04
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit

- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
submodules: recursive

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
autoconf \
automake \
libtool \
libssl-dev \
libreadline-dev \
zlib1g-dev \
libyaml-dev

- name: Get Python version from Pipfile
run: echo "PYTHON_VERSION=$(grep "python_version" Pipfile | cut -d '"' -f 2)" >> $GITHUB_ENV

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3.1.4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install pipenv
run: python -m pip install pipenv

- name: Install test dependencies
run: make init

- name: Build and run E2E tests
run: make test
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,16 @@ cleanmodules:
$(MAKE) -C $(JANSSON_PATH) distclean || true; \
fi; \

E2E_TEST_CMD = pytest --disable-warnings test/

.PHONY: init
init:
pipenv install --dev
pipenv graph

.PHONY: test
test: all
pipenv run $(E2E_TEST_CMD)

.PHONY: cleanall
cleanall: clean cleanmodules
7 changes: 3 additions & 4 deletions test/Pipfile → Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ verify_ssl = true
name = "pypi"

[packages]

[dev-packages]
aerospike = "*"
parameterized = "*"
pytest = "*"
docker = "*"

[dev-packages]
black = "*"

[requires]
python_version = "3.10"
python_version = "3.12"
263 changes: 263 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

320 changes: 0 additions & 320 deletions test/Pipfile.lock

This file was deleted.

49 changes: 49 additions & 0 deletions test/aerospike.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
service {
cluster-name aql-test
run-as-daemon false
work-directory ${state_directory}
pidfile ${state_directory}/asd.pid
proto-fd-max 1024
}

logging {
console {
context any info
}
}

network {
service {
port ${service_port}
address any
access-address ${access_address}
}

heartbeat {
mode mesh
address any
port ${heartbeat_port}
interval 100
timeout 3
connect-timeout-ms 100
}

fabric {
port ${fabric_port}
address any
}

info {
port ${info_port}
address any
}
}

namespace test {
replication-factor 1
default-ttl 0
storage-engine memory {
data-size 1G
}
nsup-period 60
}
39 changes: 20 additions & 19 deletions test/select_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ class SelectPositiveTest(unittest.TestCase):
def setUpClass(cls) -> None:
cls.ips = utils.run_containers(utils.SET_NAME, 1, version=utils.AEROSPIKE_VERSION)
cls.addClassCleanup(lambda: utils.shutdown_containers(utils.SET_NAME))
utils.create_client((cls.ips[0], 3000))
utils.create_client((cls.ips[0], utils.PORT))
utils.populate_db(utils.SET_NAME)
utils.create_sindex("a-str-index", "string", "test","a-str", set_=utils.SET_NAME)
utils.create_sindex("a-str-index", "string", "test", "a-str", set_=utils.SET_NAME)
utils.create_sindex("b-str-index", "string", "test", "b-str", set_=utils.SET_NAME)
utils.create_sindex("a-int-index", "numeric", "test", "a-int", set_=utils.SET_NAME)
utils.create_sindex("b-int-index", "numeric", "test", "b-int", set_=utils.SET_NAME)
utils.create_sindex("mix-int-index", "numeric", "test", "int-str-mix", set_=utils.SET_NAME)
utils.create_sindex("mix-str-index", "string", "test", "int-str-mix", set_=utils.SET_NAME)
utils.create_sindex("a-int-index-no-set", "numeric", "test", "a-int")
utils.create_sindex("b-int-index-no-set", "numeric", "test", "b-int")
# time.sleep(10000)

@parameterized.expand(
[
(
"select * from test",
"select * from test.{}".format(utils.SET_NAME),
"100 rows in set",
),
(
Expand All @@ -38,15 +37,15 @@ def setUpClass(cls) -> None:
)
def test_select(self, cmd, check_str):
output = utils.run_aql(
["-h", self.ips[0], "-c", cmd]
["-h", self.ips[0], "-p", str(utils.PORT), "-c", cmd]
)
self.assertEqual(output.returncode, 0)
self.assertRegex(str(output.stdout), check_str)

@parameterized.expand(
[
(
"select * from test where a-int = 0".format(utils.SET_NAME),
"select * from test.{} where a-int = 0".format(utils.SET_NAME),
"20 rows in set",
),
(
Expand All @@ -60,6 +59,8 @@ def test_select_where(self, cmd, check_str):
[
"-h",
self.ips[0],
"-p",
str(utils.PORT),
"-c",
cmd,
]
Expand All @@ -70,7 +71,7 @@ def test_select_where(self, cmd, check_str):
@parameterized.expand(
[
(
"select * from test limit 9".format(utils.SET_NAME),
"select * from test.{} limit 9".format(utils.SET_NAME),
"9 rows in set",
),
(
Expand All @@ -81,15 +82,15 @@ def test_select_where(self, cmd, check_str):
)
def test_select_limit(self, cmd, check_str):
output = utils.run_aql(
["-h", self.ips[0], "-c", cmd]
["-h", self.ips[0], "-p", str(utils.PORT), "-c", cmd]
)
self.assertEqual(output.returncode, 0)
self.assertRegex(str(output.stdout), check_str)

@parameterized.expand(
[
(
"select * from test where a-int = 0 limit 9".format(utils.SET_NAME),
"select * from test.{} where a-int = 0 limit 9".format(utils.SET_NAME),
"9 rows in set",
),
(
Expand All @@ -107,6 +108,8 @@ def test_select_where_limit(self, cmd, check_str):
[
"-h",
self.ips[0],
"-p",
str(utils.PORT),
"-c",
cmd,
]
Expand All @@ -116,14 +119,6 @@ def test_select_where_limit(self, cmd, check_str):

@parameterized.expand(
[
(
"select * from test where a-int = 0 and int = 0".format(utils.SET_NAME),
"20 rows in set",
),
(
"select * from test where a-int = 0 and b-int = 5".format(utils.SET_NAME),
"10 rows in set",
),
(
"select * from test.{} where a-int = 0 and int = 0".format(utils.SET_NAME),
"20 rows in set",
Expand Down Expand Up @@ -173,6 +168,8 @@ def test_select_double_where_table(self, cmd, check_str):
[
"-h",
self.ips[0],
"-p",
str(utils.PORT),
"-c",
cmd,
]
Expand Down Expand Up @@ -223,6 +220,8 @@ def test_select_double_where_json(self, cmd, row_count, col_1_val, col_2_val):
[
"-h",
self.ips[0],
"-p",
str(utils.PORT),
"-c",
cmd,
]
Expand Down Expand Up @@ -289,6 +288,8 @@ def test_select_double_where_limit(self, cmd, check_str):
[
"-h",
self.ips[0],
"-p",
str(utils.PORT),
"-c",
cmd,
]
Expand All @@ -302,7 +303,7 @@ class SelectNegativeTest(unittest.TestCase):
def setUpClass(cls) -> None:
cls.ips = utils.run_containers(utils.SET_NAME, 1, version=utils.AEROSPIKE_VERSION)
cls.addClassCleanup(lambda: utils.shutdown_containers(utils.SET_NAME))
utils.create_client((cls.ips[0], 3000))
utils.create_client((cls.ips[0], utils.PORT))
utils.create_sindex("b-int-index", "numeric", "test", "b", utils.SET_NAME)

@parameterized.expand(
Expand Down Expand Up @@ -349,7 +350,7 @@ def setUpClass(cls) -> None:
]
)
def test_select_syntax_error(self, cmd, assert_str):
output = utils.run_aql(["-h", self.ips[0], "-c", cmd])
output = utils.run_aql(["-h", self.ips[0], "-p", str(utils.PORT), "-c", cmd])
self.assertEqual(output.returncode, 0)
print(str(output.stderr))
self.assertTrue(assert_str in output.stderr.decode(sys.stdout.encoding))
21 changes: 11 additions & 10 deletions test/show_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ShowPositiveTest(unittest.TestCase):
def setUpClass(cls) -> None:
cls.ips = utils.run_containers(utils.SET_NAME, 1, version=utils.AEROSPIKE_VERSION)
cls.addClassCleanup(lambda: utils.shutdown_containers(utils.SET_NAME))
utils.create_client((cls.ips[0], 3000))
utils.create_client((cls.ips[0], utils.PORT))
utils.populate_db(utils.SET_NAME)
utils.create_sindex("a-str-index", "string", "test", "a-str", set_=utils.SET_NAME)
utils.create_sindex("b-str-index", "string", "test", "b-str", set_=utils.SET_NAME)
Expand All @@ -19,17 +19,17 @@ def setUpClass(cls) -> None:

@parameterized.expand(
[
("set output json; show bins", 8, ["bin", "count", "namespace", "quota"]),
("set output json; show namespaces", 2, ["namespaces"]),
("set output json; show namespaces", 1, ["namespaces"]),
(
"set output json; show indexes",
4,
[
"bin",
"context",
"exp",
"indexname",
"indextype",
"ns",
"context",
"set",
"state",
"type",
Expand All @@ -39,26 +39,27 @@ def setUpClass(cls) -> None:
"set output json; show sets",
1,
[
"device_data_bytes",
"data_used_bytes",
"default-read-touch-ttl-pct",
"default-ttl",
"disable-eviction",
"enable-index",
"index_populating",
"memory_data_bytes",
"ns",
"set",
"objects",
"set",
"sindexes",
"stop-writes-count",
"stop-writes-size",
"tombstones",
"truncate_lut",
"stop-writes-size",
"truncating"
"truncating",
],
),
]
)
def test_show_correct_keys(self, cmd: str, row_count: int, column_keys: list[str]):
output = utils.run_aql(["-h", self.ips[0], "-c", cmd])
output = utils.run_aql(["-h", self.ips[0], "-p", str(utils.PORT), "-c", cmd])
self.assertEqual(output.returncode, 0)
json_out = utils.parse_json_output(output.stdout)
print(json_out)
Expand Down
Loading
Loading