Skip to content

Commit 5c4ee12

Browse files
committed
add basic test for coverage
1 parent 8ba6786 commit 5c4ee12

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

tests/test_real_s3.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def test_anon_s3():
14-
"""Test a very basic but real S3 access."""
14+
"""Test a very basic but real S3 ANON access."""
1515
active_storage_url = "https://reductionist.jasmin.ac.uk/" # Wacasoft
1616
bigger_file = "CMIP6-test.nc" # tas; 15 (time) x 143 x 144
1717

@@ -36,13 +36,34 @@ def test_anon_s3():
3636
assert result == 197.69595
3737

3838

39-
# this could be a slow test on GHA depending on network load
40-
# also Githb machines are very far from Oxford
39+
def test_s3_small_dataset():
40+
"""Run an S3 test on a small file."""
41+
storage_options = {
42+
'key': "f2d55c6dcfc7618b2c34e00b58df3cef",
43+
'secret':
44+
"$/'#M{0{/4rVhp%n^(XeX$q@y#&(NM3W1->~N.Q6VP.5[@bLpi='nt]AfH)>78pT",
45+
'client_kwargs': {
46+
'endpoint_url': "https://uor-aces-o.s3-ext.jc.rl.ac.uk"
47+
},
48+
}
49+
active_storage_url = "https://reductionist.jasmin.ac.uk/" # Wacasoft
50+
bigger_file = "CMIP6-test.nc" # tas; 15 (time) x 143 x 144
51+
52+
test_file_uri = os.path.join(S3_BUCKET, bigger_file)
53+
print("S3 Test file path:", test_file_uri)
54+
active = Active(test_file_uri,
55+
'tas',
56+
storage_options=storage_options,
57+
active_storage_url=active_storage_url)
58+
active._version = 2
59+
result = active.min()[0:3, 4:6, 7:9]
60+
print("Result is", result)
61+
assert result == 222.09129333496094
62+
63+
4164
@pytest.mark.slow
4265
def test_s3_dataset():
4366
"""Run somewhat as the 'gold' test."""
44-
# NOTE: "https://uor-aces-o.s3-ext.jc.rl.ac.uk" is the stable S3 JASMIN
45-
# proxy that is now migrated to the new proxy (1 April 2025)
4667
storage_options = {
4768
'key': "f2d55c6dcfc7618b2c34e00b58df3cef",
4869
'secret':

0 commit comments

Comments
 (0)