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

Run CI-testing on GHA/Windows #337

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fef4ccf
Run CI-testing on GHA/Windows
amotl Nov 13, 2020
bd760d0
Adjust .gitignore file
amotl Nov 13, 2020
dd90112
CI: Add support for extracting zip archives
amotl Nov 13, 2020
6f1e981
CI: Mess with LANG or LC_ALL only on non-Windows systems
amotl Nov 13, 2020
ede5144
CI: Mitigate nasty "Unrecognized Windows Sockets error: 10106"
amotl Nov 13, 2020
bf79d43
CI: Don't invoke SourceBuildTest on Windows
amotl Nov 13, 2020
87f9e5b
CI: Try to invoke unit tests explicitly with bash to work around Windows
amotl Nov 13, 2020
a34b07e
Tests: Improve diff output at "test_geoshape_type_default"
amotl Nov 13, 2020
4d13194
CI: Skip "test_geoshape_type_default" test on Windows
amotl Nov 13, 2020
bc773b1
CI: Use LANG/LC_ALL/LANGUAGE also on Windows systems again
amotl Feb 10, 2024
4fb5e43
CI: Set environment variable `WINUTF8=1`
amotl Feb 10, 2024
ea1a42a
Windows: Attempt to fix Unicode encoding error using `chcp`
amotl Feb 10, 2024
7355ed3
Tests: Use single quotes in README's doctest commands to fix Windows
amotl Feb 10, 2024
4825bcb
README: Fix typo, an excessive line continuation character
amotl Feb 10, 2024
b70a69d
Testing: Generalize integration test setup/teardown boilerplate code
amotl Feb 10, 2024
793d55d
Testing: Add Python-based integration tests
amotl Feb 10, 2024
7e390d0
CI: Add MSYS64 to path, in order to use a different `echo`
amotl Feb 10, 2024
2028f44
CI: Quoting on `cmd` is different, even if it pretends to be `bash`?
amotl Feb 11, 2024
da92988
CI: Skip tests if incorrect quoting on Windows
amotl Feb 11, 2024
3bef462
Windows: Don't freeze on CrateDB shutdown?
amotl Feb 11, 2024
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
Prev Previous commit
Next Next commit
Testing: Add Python-based integration tests
README/doctests have problems on Windows, so this is meant as an
alternative.
  • Loading branch information
amotl committed Feb 10, 2024
commit 793d55d9c6cb7fd570e5d76e8d74b2086db28bff
86 changes: 86 additions & 0 deletions tests/test_integration_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import subprocess
import sys
import unittest

from tests.integration_util import node, setup, teardown, translate


def setUpModule():
node.start()
assert node.http_host, "http_url must be available"


def tearDownModule():
node.stop()


class IntegrationTest(unittest.TestCase):
"""
Integration tests defined as Python code, derived from README doctest code.
Rationale: Currently, running the README doctests on
Windows trips, and hasn't been resolved yet.
"""
def setUp(self) -> None:
"""
Provision tables.
"""
setup()

def tearDown(self) -> None:
"""
Destroy tables.
"""
teardown()

def cmd(self, command: str):
"""
Invoke a shell command.
"""
return subprocess.check_call(translate(command), shell=True)

def test_connectivity(self):
command = "cr8 timeit --hosts localhost:4200"
self.cmd(command)

def test_sys_cluster(self):
command = "echo 'SELECT * FROM sys.cluster;' | cr8 timeit --hosts localhost:4200"
self.cmd(command)

def test_sys_summits(self):
command = "echo 'SELECT * FROM sys.summits ORDER BY height DESC LIMIT 3;' | cr8 timeit --hosts localhost:4200"
self.cmd(command)

def test_insert_fake_data(self):
command = "cr8 insert-fake-data --hosts localhost:4200 --table x.demo --num-records 200"
self.cmd(command)

def test_insert_json(self):
command = "cat tests/demo.json | cr8 insert-json --table x.demo --hosts localhost:4200"
self.cmd(command)

def test_insert_json_print(self):
command = """echo '{"name": "Arthur"}' | cr8 insert-json --table mytable"""
self.cmd(command)

def test_insert_from_sql(self):
command = "cr8 insert-fake-data --hosts localhost:4200 --table x.demo --num-records 200"
self.cmd(command)
command = "echo 'REFRESH TABLE x.demo;' | cr8 timeit --hosts localhost:4200"
self.cmd(command)
command = """
cr8 insert-from-sql \
--src-uri "postgresql://crate@localhost:5432/doc" \
--query "SELECT name FROM x.demo" \
--hosts localhost:4200 \
--table y.demo
"""
self.cmd(command)

def test_run_spec_toml(self):
command = "cr8 run-spec specs/sample.toml localhost:4200 -r localhost:4200"
self.cmd(command)

def test_run_spec_python(self):
command = "cr8 run-spec specs/sample.py localhost:4200"
self.cmd(command)
Loading