Skip to content

Commit

Permalink
[E2E] Improve platform handling, fix faucet tests
Browse files Browse the repository at this point in the history
  • Loading branch information
banool committed Feb 22, 2024
1 parent d69d3c1 commit 9f487ad
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-faucet-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ runs:
# we don't pass the image tag.
- name: Run integration tests
if: ${{ inputs.NETWORK != 'custom' }}
run: poetry run python main.py --base-network ${{ inputs.NETWORK }} ${{ endif }} --external-test-dir ${{ runner.temp }}/testnet --image-repo-with-project ${{ inputs.GCP_DOCKER_ARTIFACT_REPO }}
run: poetry run python main.py --base-network ${{ inputs.NETWORK }} --external-test-dir ${{ runner.temp }}/testnet --image-repo-with-project ${{ inputs.GCP_DOCKER_ARTIFACT_REPO }}
working-directory: crates/aptos-faucet/integration-tests
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/faucet-tests-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

name: "Faucet Integration Tests: Prod"
on:
pull_request_target:
pull_request:
types: [labeled, opened, synchronize, reopened, auto_merge_enabled]
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion crates/aptos-faucet/core/src/server/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ mod test {
// Create it on chain using the prod devnet faucet. We fund it with
// exactly the minimum funds set in the config.
let account_address =
AuthenticationKey::ed25519(&private_key.public_key()).derived_address();
AuthenticationKey::ed25519(&private_key.public_key()).account_address();
unwrap_reqwest_result(
reqwest::Client::new()
.post("https://faucet.devnet.aptoslabs.com/fund")
Expand Down
4 changes: 3 additions & 1 deletion crates/aptos-faucet/integration-tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def main():
else:
logging.getLogger().setLevel(logging.INFO)

if platform.system() == "Darwin" and platform.processor().startswith("arm"):
# If we're on Mac and DOCKER_DEFAULT_PLATFORM is not already set, set it to
# linux/amd64 since we only publish images for that platform.
if platform.system().lower() == "darwin" and platform.processor().lower().startswith("arm"):
if not os.environ.get("DOCKER_DEFAULT_PLATFORM"):
os.environ["DOCKER_DEFAULT_PLATFORM"] = "linux/amd64"
LOG.info(
Expand Down
12 changes: 12 additions & 0 deletions crates/aptos/e2e/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

import argparse
import logging
import os
import pathlib
import platform
import shutil
import sys

Expand Down Expand Up @@ -193,6 +195,16 @@ def main():
shutil.rmtree(args.working_directory, ignore_errors=True)
pathlib.Path(args.working_directory).mkdir(parents=True, exist_ok=True)

# If we're on Mac and DOCKER_DEFAULT_PLATFORM is not already set, set it to
# linux/amd64 since we only publish images for that platform.
if platform.system().lower() == "darwin" and platform.processor().lower().startswith("arm"):
if not os.environ.get("DOCKER_DEFAULT_PLATFORM"):
os.environ["DOCKER_DEFAULT_PLATFORM"] = "linux/amd64"
LOG.info(
"Detected ARM Mac and DOCKER_DEFAULT_PLATFORM was not set, setting it "
"to linux/amd64"
)

# Run a node + faucet and wait for them to start up.
container_name = run_node(
args.base_network, args.image_repo_with_project, not args.no_pull_always
Expand Down

0 comments on commit 9f487ad

Please sign in to comment.