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

Add table smoketest + more smoketest logging #1272

Merged
merged 3 commits into from
May 24, 2024
Merged

Conversation

kazimuth
Copy link
Contributor

Description of Changes

Addresses #1260.

I also got frustrated while debugging and made it so that smoketests log all CLI commands they execute. This should hopefully make smoketests easier to debug in the future.

Example test output

You only will see stuff like this if a test fails, of course:

2024-05-21 17:20:41,376 - DEBUG - $ spacetime call -- 42f8f5ecde0a43a3a68db581dff9e8c5 add_person "Robert"
2024-05-21 17:20:41,440 - DEBUG - $ spacetime call -- 42f8f5ecde0a43a3a68db581dff9e8c5 add_person "Julie"
2024-05-21 17:20:41,495 - DEBUG - $ spacetime call -- 42f8f5ecde0a43a3a68db581dff9e8c5 add_person "Samantha"
2024-05-21 17:20:41,550 - DEBUG - $ spacetime call -- 42f8f5ecde0a43a3a68db581dff9e8c5 print_persons "BEFORE"
2024-05-21 17:20:41,604 - DEBUG - $ spacetime logs --json -- 42f8f5ecde0a43a3a68db581dff9e8c5 100
2024-05-21 17:20:41,638 - DEBUG - --- stdout ---
{"level":"Info","ts":1716326441371721,"filename":"spacetimedb","message":"Creating table `Person`"}
{"level":"Info","ts":1716326441371875,"filename":"spacetimedb","message":"Database initialized"}
{"level":"Info","ts":1716326441600721,"target":"spacetime_module","filename":"src/lib.rs","line_number":17,"message":"BEFORE: Robert"}
{"level":"Info","ts":1716326441600741,"target":"spacetime_module","filename":"src/lib.rs","line_number":17,"message":"BEFORE: Julie"}
{"level":"Info","ts":1716326441600743,"target":"spacetime_module","filename":"src/lib.rs","line_number":17,"message":"BEFORE: Samantha"}
2024-05-21 17:20:41,638 - DEBUG - --------------

2024-05-21 17:20:41,638 - INFO - Initial operations complete, updating module without clear
2024-05-21 17:20:41,638 - DEBUG - $ spacetime publish 42f8f5ecde0a43a3a68db581dff9e8c5 --project-path /tmp/tmpesvo2wne
2024-05-21 17:20:42,193 - DEBUG - --- stderr ---
info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date
   Compiling spacetime-module v0.1.0 (/tmp/tmpesvo2wne)
    Finished `release` profile [optimized] target(s) in 0.33s
Optimising module with wasm-opt...
Could not find wasm-opt to optimise the module.
For best performance install wasm-opt from https://github.com/WebAssembly/binaryen/releases.
Continuing with unoptimised module.
2024-05-21 17:20:42,193 - DEBUG - --- stdout ---
Uploading to 127.0.0.1:3000 => http://127.0.0.1:3000
Publishing module...
Updated database with address: 42f8f5ecde0a43a3a68db581dff9e8c5
2024-05-21 17:20:42,193 - DEBUG - --------------

Expected complexity level and risk

1

@kazimuth kazimuth requested a review from coolreader18 May 21, 2024 21:25
escaped_bindings_path = re.escape(
str(bindings_path).replace('\\', '\\\\')
)
escaped_bindings_path = str(bindings_path).replace('\\', '\\\\\\\\') # double escape for re.sub + toml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary because it turns out you're not supposed to use re.escape for the replacement end of a regex. It incorrectly escapes things like -; I ran into this because the path I was developing had a - in it.

Copy link
Collaborator

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kazimuth kazimuth added this pull request to the merge queue May 24, 2024
Merged via the queue into master with commit 7c90990 May 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants