Skip to content

Commit

Permalink
first stab
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Jul 20, 2023
1 parent 8ee8167 commit 7809c8c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ jobs:
- name: cargo nextest
command: cargo nextest run --features=postgres --profile ci --retries 1
cache: true
- name: REST integration tests
command: make rest-test
cache: true
# - name: REST integration tests
# command: make rest-test
# cache: true
- name: License headers check
command: bash scripts/check_license_headers.sh
cache: false
- name: rustfmt
command: cargo +nightly fmt --all -- --check
cache: false
container: public.ecr.aws/l6o9a3f9/quickwit-builder:latest
# container: public.ecr.aws/l6o9a3f9/quickwit-builder:latest
services:
# PostgreSQL service container
postgres:
Expand All @@ -72,6 +72,8 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install Ubuntu packages
run: sudo apt install protobuf-compiler python3 python3-pip
- uses: dorny/paths-filter@v2
id: modified-files
with:
Expand All @@ -88,9 +90,13 @@ jobs:
- name: Setup stable Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: "1.70"
override: true
components: rustfmt, clippy
- uses: actions-rs/[email protected]
with:
crate: cargo-deny
version: latest
- name: Setup cache
if: matrix.task.cache == true
uses: Swatinem/rust-cache@v2
Expand Down
1 change: 0 additions & 1 deletion quickwit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[workspace]
resolver = "2"
rust-version = "1.70"
members = [
"quickwit-actors",
"quickwit-aws",
Expand Down
1 change: 1 addition & 0 deletions quickwit/config/quickwit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 0.5
32 changes: 21 additions & 11 deletions quickwit/rest-api-tests/rest_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,15 @@ def add_path(self, path):
path_tree.add_script(path_segs[-1])

def visit_nodes(self, visitor, path=[]):
visitor.enter_directory(path)
success = True
success &= visitor.enter_directory(path)
for script in self.scripts:
visitor.run_scenario(path, script)
success &= visitor.run_scenario(path, script)
for k in sorted(self.children.keys()):
child_path = path + [k]
self.children[k].visit_nodes(visitor, child_path)
visitor.exit_directory(path)
success &= self.children[k].visit_nodes(visitor, child_path)
success &= visitor.exit_directory(path)
return success

# Returns a new dictionary without modifying the arguments.
# The new dictionary is the result of merging the two dictionaries
Expand All @@ -164,10 +166,12 @@ def __init__(self, engine):
self.context = {}
def run_setup_teardown_scripts(self, script_name, path):
cwd = "/".join(path)
success = True
for file_name in [script_name + ".yaml", script_name + "." + self.engine + ".yaml"]:
script_fullpath = cwd + "/" + file_name
if osp.exists(script_fullpath):
self.run_scenario(path, file_name)
success &= self.run_scenario(path, file_name)
return success
def load_context(self, path):
context = {"cwd": "/".join(path)}
for file_name in ["_ctx.yaml", "_ctx." + self.engine + ".yaml"]:
Expand All @@ -180,13 +184,14 @@ def load_context(self, path):
def enter_directory(self, path):
print("============")
self.load_context(path)
self.run_setup_teardown_scripts("_setup", path)
return self.run_setup_teardown_scripts("_setup", path)
def exit_directory(self, path):
self.run_setup_teardown_scripts("_teardown", path)
success = self.run_setup_teardown_scripts("_teardown", path)
self.context_stack.pop()
self.context = {}
for ctx in self.context_stack:
self.context.update(ctx)
return success
def run_scenario(self, path, script):
scenario_path = "/".join(path + [script])
steps = list(open_scenario(scenario_path))
Expand All @@ -208,9 +213,10 @@ def run_scenario(self, path, script):
print(step)
print(e)
print("--------------")
break
return False
else:
print("🟢 %s: %d steps (%d skipped)" % (scenario_path, num_steps_executed, num_steps_skipped))
return True

def build_path_tree(paths):
paths.sort()
Expand All @@ -222,7 +228,7 @@ def build_path_tree(paths):
def run(scenario_paths, engine):
path_tree = build_path_tree(scenario_paths)
visitor = Visitor(engine=engine)
path_tree.visit_nodes(visitor)
return path_tree.visit_nodes(visitor)

def filter_test(prefixes, test_name):
for prefix in prefixes:
Expand Down Expand Up @@ -250,8 +256,12 @@ def main():
parsed_args = arg_parser.parse_args()
scenario_filepaths = glob.glob("scenarii/**/*.yaml", recursive=True)
scenario_filepaths = list(filter_tests(parsed_args.test, scenario_filepaths))
run(scenario_filepaths, engine=parsed_args.engine)
return run(scenario_filepaths, engine=parsed_args.engine)

if __name__ == "__main__":
main()
import sys
if main():
sys.exit(0)
else:
sys.exit(1)

0 comments on commit 7809c8c

Please sign in to comment.