Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make timestamp overrides optional in tests and add faketime test #1953

Merged
merged 10 commits into from
Apr 19, 2024
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ jobs:
- name: "Check build directory"
run: ls -Rl

- name: "Install libfaketime (linux and macOS)"
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-12'
run: |
git clone https://github.com/wolfcw/libfaketime/
cd libfaketime
sudo make install
cd ..

- name: "Run tests"
run: pytest -vv --showlocals

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# - this is for builds-from-source
# - release builds are controlled by `misc/azure-release.yml`
# - this should be set to the current core release, not `dev`
TILEDB_VERSION = "2.21.1"
TILEDB_VERSION = "2.22.0"

# allow overriding w/ environment variable
TILEDB_VERSION = (
Expand Down
27 changes: 16 additions & 11 deletions tiledb/tests/test_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class SOMA919Test(DiskTestCase):
We've distilled @atolopko-czi's gist example using the TileDB-Py API directly.
"""

def run_test(self):
def run_test(self, use_timestamps):
import tempfile

import numpy as np
Expand All @@ -267,13 +267,17 @@ def run_test(self):

root_uri = tempfile.mkdtemp()

# this tiledb.Ctx is how we set the write timestamps for tiledb.Group
group_ctx100 = tiledb.Ctx(
{
"sm.group.timestamp_start": 100,
"sm.group.timestamp_end": 100,
}
)
if use_timestamps:
group_ctx100 = tiledb.Ctx(
{
"sm.group.timestamp_start": 100,
"sm.group.timestamp_end": 100,
}
)
timestamp = 100
else:
group_ctx100 = tiledb.Ctx()
timestamp = None

# create the group and add a dummy subgroup "causes_bug"
tiledb.Group.create(root_uri, ctx=group_ctx100)
Expand All @@ -284,7 +288,7 @@ def run_test(self):
# add an array to the group (in a separate write operation)
with tiledb.Group(root_uri, mode="w", ctx=group_ctx100) as expt:
df_path = os.path.join(root_uri, "df")
tiledb.from_numpy(df_path, np.ones((100, 100)), timestamp=100)
tiledb.from_numpy(df_path, np.ones((100, 100)), timestamp=timestamp)
expt.add(name="df", uri=df_path)

# check our view of the group at current time;
Expand All @@ -301,12 +305,13 @@ def run_test(self):
tiledb.libtiledb.version() < (2, 15, 0),
reason="SOMA919 fix implemented in libtiledb 2.15",
)
def test_soma919(self):
@pytest.mark.parametrize("use_timestamps", [True, False])
def test_soma919(self, use_timestamps):
N = 100
fails = 0
for i in range(N):
try:
self.run_test()
self.run_test(use_timestamps)
except AssertionError:
fails += 1
if fails > 0:
Expand Down
Loading
Loading