From b02507605c00a399d381e3896d653a571dd42ec6 Mon Sep 17 00:00:00 2001 From: "Sergio C. Orozco Torres" Date: Sat, 22 Jun 2024 16:43:40 +0000 Subject: [PATCH 1/2] Devcontainer testing levantando localhost:5000 --- .devcontainer/testing/devcontainer.json | 25 +++++++++++-------- .../testing/docker-compose.extend.yml | 9 ------- compose.yaml | 8 +----- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 .devcontainer/testing/docker-compose.extend.yml diff --git a/.devcontainer/testing/devcontainer.json b/.devcontainer/testing/devcontainer.json index 3f0f2139..6daa16b0 100644 --- a/.devcontainer/testing/devcontainer.json +++ b/.devcontainer/testing/devcontainer.json @@ -1,17 +1,22 @@ { "name": "Selenium Tests", - "dockerComposeFile": [ - "../../compose.yaml", - "docker-compose.extend.yml" - ], - "service": "testing", - "shutdownAction": "stopCompose", - "workspaceFolder": "/workspace/", + "image": "mcr.microsoft.com/vscode/devcontainers/universal", + "hostRequirements": { "cpus": 2 }, + "waitFor": "onCreateCommand", + "onCreateCommand": "pipx install lektor && pip install -r test-requirements.txt && npm install", + "postAttachCommand": { + "server": "lektor server", + "css": "npm run watch" + }, + "portsAttributes": { + "5000": { + "label": "Lektor Server", + "onAutoForward": "openPreview" + } + }, "forwardPorts": [4444, 5000, 7900], - "onCreateCommand": "pip install -r test-requirements.txt", - "postAttachCommand": "python -m pytest", "remoteEnv": { - "TEST_COMMAND_EXECUTOR": "http://browser:4444/wd/hub" + "TEST_COMMAND_EXECUTOR": "http://localhost:4444/wd/hub" }, "customizations": { "codespaces": { diff --git a/.devcontainer/testing/docker-compose.extend.yml b/.devcontainer/testing/docker-compose.extend.yml deleted file mode 100644 index 7805b587..00000000 --- a/.devcontainer/testing/docker-compose.extend.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: '3' -services: - testing: - image: mcr.microsoft.com/vscode/devcontainers/python:3.11 - volumes: - # Mounts the project folder to '/workspace'. While this file is in .devcontainer, - # mounts are relative to the first file in the list, which is a level up. - - .:/workspace:cached - command: /bin/sh -c "while sleep 1000; do :; done" diff --git a/compose.yaml b/compose.yaml index 6c47c3da..e071364c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,3 @@ -version: '3' services: browser: image: selenium/standalone-${TEST_BROWSER:-chrome} @@ -7,9 +6,4 @@ services: - 4444:4444 # Selenium service - 5900:5900 # VNC server - 7900:7900 # VNC browser client - webapp: - build: ./ - ports: - - 5000:5000 # Lektor - volumes: - - .:/app + network_mode: "host" From b88bc0537e9292d01ae2e510d82f54d608577441 Mon Sep 17 00:00:00 2001 From: "Sergio C. Orozco Torres" Date: Sat, 22 Jun 2024 17:19:01 +0000 Subject: [PATCH 2/2] Network Mode host no compatible ports binding --- .devcontainer/testing/devcontainer.json | 3 ++- compose.yaml | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.devcontainer/testing/devcontainer.json b/.devcontainer/testing/devcontainer.json index 6daa16b0..40bb7dff 100644 --- a/.devcontainer/testing/devcontainer.json +++ b/.devcontainer/testing/devcontainer.json @@ -16,7 +16,8 @@ }, "forwardPorts": [4444, 5000, 7900], "remoteEnv": { - "TEST_COMMAND_EXECUTOR": "http://localhost:4444/wd/hub" + "TEST_COMMAND_EXECUTOR": "http://localhost:4444/wd/hub", + "PYTEST_BASE_URL": "http://localhost:5000" }, "customizations": { "codespaces": { diff --git a/compose.yaml b/compose.yaml index e071364c..9e89f299 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,8 +2,4 @@ services: browser: image: selenium/standalone-${TEST_BROWSER:-chrome} shm_size: '2gb' - ports: - - 4444:4444 # Selenium service - - 5900:5900 # VNC server - - 7900:7900 # VNC browser client network_mode: "host"