Skip to content

Commit

Permalink
[CLI] Add customer header checking to e2e (#8460)
Browse files Browse the repository at this point in the history
* add customer header checking to e2e

* remove trailing slash

* Update crates/aptos/e2e/cases/init.py

Update error message

Co-authored-by: Daniel Porteous (dport) <daniel@dport.me>

---------

Co-authored-by: Daniel Porteous (dport) <daniel@dport.me>
  • Loading branch information
0xmigo and banool committed Jul 7, 2023
1 parent 20ee53e commit 9da9ec9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions crates/aptos/e2e/cases/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ def test_metrics_accessible(run_helper: RunHelper, test_name=None):
# JSON this will throw an exception which will be caught as a test failure.
metrics_url = run_helper.get_metrics_url(json=True)
requests.get(metrics_url).json()


@test_case
def test_aptos_header_included(run_helper: RunHelper, test_name=None):
# Make sure the aptos-cli header is included on the original request
response = requests.get(run_helper.get_metrics_url())

if 'request_source_client="aptos-cli' not in response.text:
raise TestError("Request should contain the correct aptos header: aptos-cli")
5 changes: 4 additions & 1 deletion crates/aptos/e2e/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import sys

from cases.account import test_account_create, test_account_fund_with_faucet
from cases.init import test_init, test_metrics_accessible
from cases.init import test_aptos_header_included, test_init, test_metrics_accessible
from common import Network
from local_testnet import run_node, stop_node, wait_for_startup
from test_helpers import RunHelper
Expand Down Expand Up @@ -106,6 +106,9 @@ def run_tests(run_helper):
test_account_fund_with_faucet(run_helper)
test_account_create(run_helper)

# Make sure the aptos-cli header is included on the original request
test_aptos_header_included(run_helper)


def main():
args = parse_args()
Expand Down

0 comments on commit 9da9ec9

Please sign in to comment.