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

Dev container for AMTH #252

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Mobile Wallet Test Dev",
//"workspaceMount": "source=${localWorkspaceFolder}/aries-mobile-tests,target=/aries-mobile-tests,type=bind",
//"workspaceFolder": "/aries-mobile-tests",
// Use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
// Path is relative to the devcontainer.json file.
"context": "../aries-mobile-tests",
"dockerfile": "../aries-mobile-tests/Dockerfile.dev-harness"
},
"appPort": ["49160:49160"],

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"docker-from-docker": "latest"
},

// If using a local android device/emulator you will need to mount to the location of the app apk so that it can be installed.
// Change this to your absolute path to the location of the android apk you want to test with
"mounts": [
{ "source": "/Users/Shel/Projects/BC.gov/apps/bc-wallet", "target": "/bc-wallet/app", "type": "bind" },
Copy link

Choose a reason for hiding this comment

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

not sure about absolute paths. Any creative ways to address it? I think of a dev container something that works out of the box to make dev life easier. The need to update paths might create false changes. But, I am okay with this being a first pass.

Copy link
Contributor Author

@nodlesh nodlesh Jun 6, 2024

Choose a reason for hiding this comment

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

We could use something like ${localEnv:SOME_LOCAL_VAR} to not have absolute paths in the devcontiner.json file.

"mounts": [
		{ "source": "${localEnv:APP_LOCATION}/apps/bc-wallet", "target": "/bc-wallet/app", "type": "bind" },

However, this doesn't really fix the issue of having it work out of the box. The dev will have to setup that app location and point the env var to it. To get it to work out of the box, the repo would have to be in control of the apk, which it of course isn't.

The DEV_CONTAINERS.MD talks about this mount and the need to set the source to the location of the apk.

We could write a script to pull android artifacts from the BC Wallet repo, and place it in a predefined location on local, but that assumes the dev always wants to use the latest app build in the repo, and that wouldn't be the case, since they may have a local build based on some uncommitted work in a PR.

This should be a one time setting, and from then on out, the dev needs to just put new apk builds in that location.

Copy link

Choose a reason for hiding this comment

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

What is the purpose of that path? Just a place to get the app APK file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor

@jleach jleach Jun 20, 2024

Choose a reason for hiding this comment

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

@nodlesh ${localWorkspaceFolder}/apps/bc-wallet? I think localWorkspaceFolder will be the root of the checked out repo / project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could do that but I don't think it saves any effort. /apps/bc-wallet/ isn't in the repo and you will have to create it and put the apk there anyway, so why not just leave it open to put the app where ever you want?

{ "source": "/Users/Shel/Library/Developer/Xamarin/android-sdk-macosx/emulator/resources","target": "/qrcodes", "type": "bind" }
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [4723, 5037, 8554, 49160],

"initializeCommand": "docker network inspect aath_network >/dev/null 2>&1 || docker network create aath_network",

"runArgs": [
"--network=aath_network",
"--name=amth_test_dev"
],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip install --upgrade pip && \
// pip install --no-cache-dir aiohttp behave allure-behave python-decouple",
"postCreateCommand": "pip install --upgrade pip && \
pip install -r aries-mobile-tests/requirements.txt && \
pip install --no-cache-dir python-decouple && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && \
sudo apt-get install -y nodejs && \
npm install -g appium && \
appium driver install uiautomator2",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"extensions.verifySignature": false
},
"extensions": [
"ms-python.python",
"ms-python.debugpy",
"ms-python.vscode-pylance",
"alexkrechik.cucumberautocomplete",
"zainchen.json"
]
}
},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ __pycache__
.logs
.build
*.log
.vscode/
all_steps.py
aries-mobile-tests/features/steps/all_steps.py
aries-mobile-tests/allure/allure-results/environment.properties
Expand Down
188 changes: 188 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Python: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Behave current file",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs"
},
"args": [
"${file}",
"--tags=@T002-Proof",
"-k",
"-D",
"Issuer=AATH;http://acme_agent:9020",
"-D",
"Verifier=AATH;http://bob_agent:9030"
]
},
{
"name": "Python: Behave current file LocalAndroid",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "LocalAndroid"
},
"args": [
"${file}",
"--tags=@T002-Proof",
"-k",
"-D",
"Issuer=AATH;http://host.docker.internal:9020",
"-D",
"Verifier=AATH;http://host.docker.internal:9030"
]
},
{
"name": "Python: Behave current file Sauce Labs non-AATH Agents",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs",
"TEST_RETRY_ATTEMPTS_OVERRIDE": "1"
},
"args": [
"${file}",
"--tags=@T009-Proof",
"-k",
"-D",
"Issuer=CANdy_UVP;https://openvp-candy-issuer-test.apps.silver.devops.gov.bc.ca/",
"-D",
"Verifier=PCFT_Chat;https://pctftest-test.vonx.io/"
]
},
{
"name": "Python: Behave current file Sauce Labs Connectionless",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs",
"TEST_RETRY_ATTEMPTS_OVERRIDE": "1"
},
"args": [
"${file}",
"--tags=@T009.1-Proof",
"-k",
"-D",
"Issuer=CANdy_UVP;https://openvp-candy-issuer-test.apps.silver.devops.gov.bc.ca/",
"-D",
"Verifier=AATH;http://bob_agent:9030"
]
},
{
"name": "Python: Behave current file Sauce Labs BCSC",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs",
"BC_VP_USERNAME": "",
"BC_VP_PASSWORD": "",
"BC_VP_HOLDER_EMAIL": "",
"BC_VP_HOLDER_EMAIL_PASSWORD": "",
"BCSC_ACCOUNT_USER": "",
"BCSC_ACCOUNT_PASSWORD": "",
"GOOGLE_API_TOKEN": "",
"GOOGLE_API_CREDENTIALS": ""
},
"args": [
"${file}",
"--tags=@T001-BCSC",
"-k",
"-D",
"Issuer=BC_VP;https://bcvcpilot-issuer-admin-test.apps.silver.devops.gov.bc.ca",
"-D",
"Verifier=BC_Person_Showcase;https://bc-wallet-demo-agent-admin-test.apps.silver.devops.gov.bc.ca"
]
},
{
"name": "Python: Behave current file Mobile Verifier",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs"
},
"args": [
"${file}",
"--tags=@T001.2-MobileVerifier",
"-k",
"-D",
"Issuer=CANdy_UVP;https://openvp-candy-issuer-test.apps.silver.devops.gov.bc.ca/",
"-D",
"Holder=AATH;http://bob_agent:9030"
]
},
{
"name": "Python: Behave current file Sauce Labs BC Showcase",
"type": "debugpy",
"request": "launch",
"module": "behave",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/aries-mobile-tests",
"env": {
"SAUCE_USERNAME": "",
"SAUCE_ACCESS_KEY": "",
"SL_REGION": "us-west-1",
"DEVICE_CLOUD": "SauceLabs",
"TEST_RETRY_ATTEMPTS_OVERRIDE": "1"
},
"args": [
"${file}",
"--tags=@T002-BCShowcase",
"-k",
"-D",
"Issuer=BCShowcaseIssuer;https://bc-wallet-demo.apps.silver.devops.gov.bc.ca/",
"-D",
"Verifier=BCShowcaseVerifier;https://bc-wallet-demo.apps.silver.devops.gov.bc.ca/"
]
},
]
}
47 changes: 47 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Start Aries Agents",
"type": "shell",
"command": "cd ~/Projects/BC.gov/aries-agent-test-harness && LEDGER_URL_CONFIG=http://test.bcovrin.vonx.io TAILS_SERVER_URL_CONFIG=https://tails.vonx.io AGENT_CONFIG_FILE=/aries-backchannels/acapy/auto_issuer_config.yaml ./manage start -a acapy-main -b acapy-main -n"
},
{
"label": "Stop Aries Agents",
"type": "shell",
"command": "cd ~/Projects/BC.gov/aries-agent-test-harness && ./manage stop"
},
{
"label": "Start Appium Server in Dev Container",
"type": "shell",
"command": "appium --base-path /wd/hub --allow-cors",
"isBackground": true,
"problemMatcher": {
"owner": "custom",
"pattern": {
"regexp": ".*"
},
"background": {
"activeOnStart": true,
"beginsPattern": "^\\[Appium\\] Welcome to Appium v.*",
"endsPattern": "^\\[Appium\\] Appium REST http interface listener started on 0.0.0.0:4723"
}
},
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Stop Appium Server",
"type": "shell",
"command": "pkill -2 -f appium",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
Loading