-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
rpc-alt: e2e tests #20729
Open
amnn
wants to merge
4
commits into
amnn/rpc-metrics
Choose a base branch
from
amnn/rpc-e2e
base: amnn/rpc-metrics
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
rpc-alt: e2e tests #20729
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
name = "sui-indexer-alt-e2e-tests" | ||
version = "0.1.0" | ||
authors = ["Mysten Labs <[email protected]>"] | ||
license = "Apache-2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[[test]] | ||
name = "tests" | ||
harness = false | ||
|
||
[dependencies] | ||
|
||
[dev-dependencies] | ||
anyhow.workspace = true | ||
async-trait.workspace = true | ||
datatest-stable.workspace = true | ||
diesel = { workspace = true, features = ["chrono"] } | ||
diesel-async = { workspace = true, features = ["bb8", "postgres", "async-connection-wrapper"] } | ||
prometheus.workspace = true | ||
reqwest.workspace = true | ||
serde_json.workspace = true | ||
telemetry-subscribers.workspace = true | ||
tokio.workspace = true | ||
tokio-util.workspace = true | ||
url.workspace = true | ||
|
||
sui-indexer-alt.workspace = true | ||
sui-indexer-alt-framework.workspace = true | ||
sui-indexer-alt-jsonrpc.workspace = true | ||
sui-pg-db.workspace = true | ||
sui-transactional-test-runner.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#![forbid(unsafe_code)] | ||
|
||
// Empty src/lib.rs to get rusty-tags working. |
9 changes: 9 additions & 0 deletions
9
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/governance/custom_rgp.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
processed 2 tasks | ||
|
||
task 1, lines 6-10: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
"result": "1337" | ||
} |
10 changes: 10 additions & 0 deletions
10
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/governance/custom_rgp.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 70 --simulator --objects-snapshot-min-checkpoint-lag 2 --reference-gas-price 1337 | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getReferenceGasPrice", | ||
"params": [] | ||
} |
9 changes: 9 additions & 0 deletions
9
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/governance/default_rgp.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
processed 2 tasks | ||
|
||
task 1, lines 6-10: | ||
//# run-jsonrpc | ||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
"result": "1000" | ||
} |
10 changes: 10 additions & 0 deletions
10
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/governance/default_rgp.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 70 --simulator --objects-snapshot-min-checkpoint-lag 2 | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getReferenceGasPrice", | ||
"params": [] | ||
} |
30 changes: 30 additions & 0 deletions
30
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/test_framework/framework.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
processed 6 tasks | ||
|
||
task 1, lines 19-22: | ||
//# run-graphql | ||
Error: GraphQL queries are not supported in these tests | ||
|
||
task 2, line 24: | ||
//# run-jsonrpc | ||
Error: Missing JSON-RPC query | ||
|
||
task 3, lines 26-29: | ||
//# run-jsonrpc | ||
Error: Failed to parse JSON-RPC query | ||
|
||
task 4, lines 31-35: | ||
//# run-jsonrpc | ||
Error: Failed to parse JSON-RPC query | ||
|
||
task 5, lines 37-41: | ||
//# run-jsonrpc --show-headers | ||
Headers: { | ||
"content-type": "application/json; charset=utf-8", | ||
"content-length": "40", | ||
} | ||
|
||
Response: { | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
"result": "1000" | ||
} |
41 changes: 41 additions & 0 deletions
41
crates/sui-indexer-alt-e2e-tests/tests/jsonrpc/test_framework/framework.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 70 --simulator --objects-snapshot-min-checkpoint-lag 2 | ||
|
||
// This test is checking details about the test runner: | ||
// | ||
// (1) It does not support GraphQL queries. | ||
// (2) Tests will fail if the JSON-RPC query does not contian methods or | ||
// params. | ||
// - No JSON object. | ||
// - Missing params. | ||
// - Extra trailing comma (tricky!) | ||
// (3) Displaying response headers is supported. | ||
// | ||
// The test description is at the top because the JSON does not have explicit | ||
// syntax for comments. | ||
|
||
//# run-graphql | ||
{ | ||
chainIdentifier | ||
} | ||
|
||
//# run-jsonrpc | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getReferenceGasPrice" | ||
} | ||
|
||
//# run-jsonrpc | ||
{ | ||
"method": "suix_getReferenceGasPrice", | ||
"params": [], | ||
} | ||
|
||
//# run-jsonrpc --show-headers | ||
{ | ||
"method": "suix_getReferenceGasPrice", | ||
"params": [] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be run-jsonrpc?
Also curious why it was possible to mix up? Should we error if it happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this is as intended. We do error if you try to run the wrong kind of query, and in fact this is the test for that (see the comments above this line).