From 0470626c9158cd6fe5a4b59471aff136a59d1cce Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 12:08:56 +0530 Subject: [PATCH 01/11] Setup zango project for e2e testing. --- .github/workflows/e2e-cypress-tests.yml | 62 +++++++++++++++++++------ deploy/dev.dockerfile | 2 +- deploy/docker_compose.dev.yml | 8 ++-- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index 9af951ea9..7cb82ad08 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -3,9 +3,9 @@ name: End to End Cypress Test on: push: branches: - - test/cypress - paths: - - "frontend/**" + - zango_setup_for_cypress + # paths: + # - "frontend/**" jobs: cypress-run: @@ -16,18 +16,54 @@ jobs: - name: Checkout uses: actions/checkout@v3 - # Step 2: Set up Node.js environment + # Step 2: Set up python + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + # Step 3: Start up zango project + - name: Set up Zango project + run: | + python3 setup_project.py + + # Step 4: Start zango project server + - name: Start Zango project server + run: | + cd zproject + export HOST_UID=$(id -u) + export HOST_GID=$(id -g) + DOCKER_BUILDKIT=0 docker-compose build + docker-compose up -d + cd .. + + # Step 5: Map localhost to domain + - name: Setup local domain + run: echo '0.0.0.0 test.zango.local' | sudo tee -a /etc/hosts + + # Step 6: Verify zango project is up and running + - name: Verify zango project is up and running + run: | + RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -L http://test.zango.local:8000/platform) + if [ "$RESPONSE" -eq 200 ]; then + echo "Backend is up and running at http://test.zango.local:8000" + else + echo "Backend is not responding as expected. HTTP response code: $RESPONSE" >&2 + exit 1 + fi + + # Step 6: Set up Node.js environment - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: "18" - # Step 3: Install dependencies - - name: Install dependencies + # Step 7: Install dependencies + - name: Install cypress dependencies run: npm install working-directory: e2e-tests - - # Step 4: Run Cypress tests and record results + + # Step 8: Run Cypress tests and record results - name: Run Cypress tests uses: cypress-io/github-action@v6.5.0 with: @@ -36,12 +72,12 @@ jobs: env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - # Step 5: Generate Cucumber HTML Report + # Step 9: Generate Cucumber HTML Report - name: Generate Cucumber HTML Report run: node cucumber-html-report.js working-directory: e2e-tests - # Step 6: Upload Cypress screenshots on failure + # Step 10: Upload Cypress screenshots on failure - name: Upload Cypress screenshots uses: actions/upload-artifact@v3 if: failure() @@ -50,7 +86,7 @@ jobs: path: e2e-tests/cypress/screenshots if-no-files-found: ignore - # Step 7: Upload Cypress videos + # Step 11: Upload Cypress videos - name: Upload Cypress videos uses: actions/upload-artifact@v3 with: @@ -58,10 +94,10 @@ jobs: path: e2e-tests/cypress/videos if-no-files-found: ignore - # Step 8: Upload Cucumber HTML Report + # Step 12: Upload Cucumber HTML Report - name: Upload Cucumber HTML Report uses: actions/upload-artifact@v3 with: name: cucumber-html-report path: e2e-tests/cucumber-html-report.html - if-no-files-found: ignore + if-no-files-found: ignore \ No newline at end of file diff --git a/deploy/dev.dockerfile b/deploy/dev.dockerfile index 3165382f7..11fe4a3c6 100644 --- a/deploy/dev.dockerfile +++ b/deploy/dev.dockerfile @@ -10,7 +10,7 @@ ARG GID # Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions RUN apt update && \ apt install -y sudo && \ - groupadd -o -g ${GID} -r zango_user && \ + groupadd -o -g $GID -r zango_user && \ adduser --uid $UID --gid $GID --disabled-password --gecos "" zango_user && \ echo 'zango_user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers diff --git a/deploy/docker_compose.dev.yml b/deploy/docker_compose.dev.yml index 3b6550695..4be8b8132 100644 --- a/deploy/docker_compose.dev.yml +++ b/deploy/docker_compose.dev.yml @@ -24,8 +24,8 @@ services: context: . dockerfile: dev.dockerfile args: - - UID=${UID} - - GID=${GID} + - UID=${HOST_UID} + - GID=${HOST_GID} ports: - "8000:8000" depends_on: @@ -47,8 +47,8 @@ services: context: . dockerfile: dev.dockerfile args: - - UID=${UID} - - GID=${GID} + - UID=${HOST_UID} + - GID=${HOST_GID} command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} worker -l info" volumes: - .:/zango/ From 97a4a5e341b6d45953cc1a4958049bbf9a14604a Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 15:55:50 +0530 Subject: [PATCH 02/11] Setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index 7cb82ad08..45b6cdb0d 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -44,9 +44,9 @@ jobs: # Step 6: Verify zango project is up and running - name: Verify zango project is up and running run: | - RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -L http://test.zango.local:8000/platform) + RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -L http://localhost:8000/platform) if [ "$RESPONSE" -eq 200 ]; then - echo "Backend is up and running at http://test.zango.local:8000" + echo "Backend is up and running at http://localhost:8000" else echo "Backend is not responding as expected. HTTP response code: $RESPONSE" >&2 exit 1 From 1172d88e5ad773c79ecfa4e0fdfb412b1ebb16d4 Mon Sep 17 00:00:00 2001 From: kc-diabeat Date: Wed, 31 Jul 2024 16:29:38 +0530 Subject: [PATCH 03/11] updated domain for e2e tests to localhost --- e2e-tests/cypress/support/commands.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e-tests/cypress/support/commands.js b/e2e-tests/cypress/support/commands.js index adcf2b9d9..4fa8a4df0 100644 --- a/e2e-tests/cypress/support/commands.js +++ b/e2e-tests/cypress/support/commands.js @@ -27,7 +27,8 @@ import "cypress-file-upload"; Cypress.Commands.add("login", (username, password) => { - cy.visit("http://cypress.serveo.net/auth/login/?next=/platform/"); + cy.visit("http://localhost:8000/auth/login/?next=/platform/"); + //cy.visit("http://cypress.serveo.net/auth/login/?next=/platform/"); // cy.visit('http://10.18.1.105:8006/auth/login/?next=/platform/'); cy.get('[type="text"]').type(username); cy.get('[type="password"]').type(password); From 4f7a12ea31ef62ce358c01a13f925e20314cb80c Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 17:49:12 +0530 Subject: [PATCH 04/11] setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 23 +++++-- deploy/docker_compose.test.yml | 90 +++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 deploy/docker_compose.test.yml diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index 45b6cdb0d..d5942e00c 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -22,20 +22,29 @@ jobs: with: python-version: '3.9' - # Step 3: Start up zango project - - name: Set up Zango project + # Step 3: Start up environment variables + - name: Set up environment variables run: | - python3 setup_project.py + echo " + PLATFORM_USERNAME=platform_admin@zango.dev + PLATFORM_USER_PASSWORD=Zango@123 + PROJECT_NAME=zango_project + POSTGRES_USER=zango_admin + POSTGRES_PASSWORD=zangopass + POSTGRES_DB=zango + POSTGRES_HOST=postgres + POSTGRES_PORT=5432 + REDIS_HOST=redis + REDIS_PORT=6379 + PLATFORM_DOMAIN_URL=localhost + ">>.env # Step 4: Start zango project server - name: Start Zango project server run: | - cd zproject export HOST_UID=$(id -u) export HOST_GID=$(id -g) - DOCKER_BUILDKIT=0 docker-compose build - docker-compose up -d - cd .. + DOCKER_BUILDKIT=0 docker-compose -f deploy/docker_compose.test.yml up --build -d # Step 5: Map localhost to domain - name: Setup local domain diff --git a/deploy/docker_compose.test.yml b/deploy/docker_compose.test.yml new file mode 100644 index 000000000..2d50c5fe9 --- /dev/null +++ b/deploy/docker_compose.test.yml @@ -0,0 +1,90 @@ +version: "3.8" + +services: + postgres: + image: postgres + env_file: + - ../.env + ports: + - "5432:5432" + healthcheck: + test: + [ + "CMD-SHELL", + "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -p ${POSTGRES_PORT}", + ] + interval: 5s + timeout: 5s + retries: 5 + volumes: + - dev_db:/var/lib/postgresql/data + + app: + build: + context: ../ + dockerfile: Dockerfile + args: + - UID=${HOST_UID} + - GID=${HOST_GID} + ports: + - "8000:8000" + depends_on: + postgres: + condition: service_healthy + env_file: + - ../.env + environment: + ENV: dev + volumes: + - .:/zango/ + healthcheck: + test: ["CMD-SHELL", "netstat -ltn | grep -q 8000"] + timeout: 5s + retries: 3 + + celery: + build: + context: ../ + dockerfile: Dockerfile + args: + - UID=${HOST_UID} + - GID=${HOST_GID} + command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} worker -l info" + volumes: + - .:/zango/ + env_file: + - ../.env + depends_on: + app: + condition: service_healthy + redis: + condition: service_healthy + + redis: + image: redis + ports: + - "6379:6379" + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 3 + + celery_beat: + build: + context: ../ + dockerfile: Dockerfile + command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler" + volumes: + - .:/zango/ + env_file: + - ../.env + depends_on: + app: + condition: service_healthy + redis: + condition: service_healthy + + +volumes: + dev_db: From f39223021b2eb8377e1c00c6f318fce020517740 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:07:12 +0530 Subject: [PATCH 05/11] setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 7 +++++-- deploy/docker_compose.test.yml | 12 ++++++------ deploy/test.dockerfile | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 deploy/test.dockerfile diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index d5942e00c..1c77c9fb9 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -21,6 +21,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.9' + + -name: Build latest Zango image + run: docker build -t local/zango-base:latest . # Step 3: Start up environment variables - name: Set up environment variables @@ -39,8 +42,8 @@ jobs: PLATFORM_DOMAIN_URL=localhost ">>.env - # Step 4: Start zango project server - - name: Start Zango project server + # Step 4: Build and start zango project server + - name: Build and start Zango project run: | export HOST_UID=$(id -u) export HOST_GID=$(id -g) diff --git a/deploy/docker_compose.test.yml b/deploy/docker_compose.test.yml index 2d50c5fe9..95d69f21d 100644 --- a/deploy/docker_compose.test.yml +++ b/deploy/docker_compose.test.yml @@ -21,8 +21,8 @@ services: app: build: - context: ../ - dockerfile: Dockerfile + context: . + dockerfile: test.dockerfile args: - UID=${HOST_UID} - GID=${HOST_GID} @@ -44,8 +44,8 @@ services: celery: build: - context: ../ - dockerfile: Dockerfile + context: . + dockerfile: test.dockerfile args: - UID=${HOST_UID} - GID=${HOST_GID} @@ -72,8 +72,8 @@ services: celery_beat: build: - context: ../ - dockerfile: Dockerfile + context: . + dockerfile: test.dockerfile command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler" volumes: - .:/zango/ diff --git a/deploy/test.dockerfile b/deploy/test.dockerfile new file mode 100644 index 000000000..a117c7242 --- /dev/null +++ b/deploy/test.dockerfile @@ -0,0 +1,22 @@ +FROM local/zango-base:latest + +RUN apt update +RUN apt-get install -y net-tools +RUN apt install ffmpeg -y + +ARG UID +ARG GID + +# Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions +RUN apt update && \ + apt install -y sudo && \ + groupadd -o -g $GID -r zango_user && \ + adduser --uid $UID --gid $GID --disabled-password --gecos "" zango_user && \ + echo 'zango_user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + +# Set the non-root user as the default user +USER zango_user + +COPY init.sh /zango/ +WORKDIR /zango/ +CMD ["/bin/sh", "init.sh"] From 71f02ae6e4be78ff42e4205f67806ac7b75592b0 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:09:40 +0530 Subject: [PATCH 06/11] setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index 1c77c9fb9..990d435d9 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -22,7 +22,7 @@ jobs: with: python-version: '3.9' - -name: Build latest Zango image + - name: Build latest Zango image run: docker build -t local/zango-base:latest . # Step 3: Start up environment variables From 206a364a3a4c3b1897dd55b0929afdf999b2f571 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:19:36 +0530 Subject: [PATCH 07/11] setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index 990d435d9..a5cf84130 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -47,7 +47,8 @@ jobs: run: | export HOST_UID=$(id -u) export HOST_GID=$(id -g) - DOCKER_BUILDKIT=0 docker-compose -f deploy/docker_compose.test.yml up --build -d + DOCKER_BUILDKIT=0 docker-compose -f deploy/docker_compose.test.yml build + docker-compose -f deploy/docker_compose.test.yml up -d # Step 5: Map localhost to domain - name: Setup local domain From 9b8f8f740268db384b49546c1582f91afffcfed5 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:23:12 +0530 Subject: [PATCH 08/11] setup zango project for cypress. --- deploy/docker_compose.test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/docker_compose.test.yml b/deploy/docker_compose.test.yml index 95d69f21d..2dc4ceb96 100644 --- a/deploy/docker_compose.test.yml +++ b/deploy/docker_compose.test.yml @@ -74,6 +74,9 @@ services: build: context: . dockerfile: test.dockerfile + args: + - UID=${HOST_UID} + - GID=${HOST_GID} command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler" volumes: - .:/zango/ From 359f732ff17920bda9c9aed103de6d53f0fbca8f Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:29:49 +0530 Subject: [PATCH 09/11] setup zango project for cypress --- .github/workflows/e2e-cypress-tests.yml | 2 +- deploy/docker_compose.test.yml | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e-cypress-tests.yml b/.github/workflows/e2e-cypress-tests.yml index a5cf84130..4dadc341a 100644 --- a/.github/workflows/e2e-cypress-tests.yml +++ b/.github/workflows/e2e-cypress-tests.yml @@ -40,7 +40,7 @@ jobs: REDIS_HOST=redis REDIS_PORT=6379 PLATFORM_DOMAIN_URL=localhost - ">>.env + " >> deploy/.env # Step 4: Build and start zango project server - name: Build and start Zango project diff --git a/deploy/docker_compose.test.yml b/deploy/docker_compose.test.yml index 2dc4ceb96..a4b222fc9 100644 --- a/deploy/docker_compose.test.yml +++ b/deploy/docker_compose.test.yml @@ -4,7 +4,7 @@ services: postgres: image: postgres env_file: - - ../.env + - .env ports: - "5432:5432" healthcheck: @@ -32,7 +32,7 @@ services: postgres: condition: service_healthy env_file: - - ../.env + - .env environment: ENV: dev volumes: @@ -53,7 +53,7 @@ services: volumes: - .:/zango/ env_file: - - ../.env + - .env depends_on: app: condition: service_healthy @@ -71,17 +71,12 @@ services: retries: 3 celery_beat: - build: - context: . - dockerfile: test.dockerfile - args: - - UID=${HOST_UID} - - GID=${HOST_GID} + image: local/zango-base:latest command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler" volumes: - .:/zango/ env_file: - - ../.env + - .env depends_on: app: condition: service_healthy From 8e82d11bbbaab0f41b0e37bd95f81c96048c1b27 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Wed, 31 Jul 2024 18:43:11 +0530 Subject: [PATCH 10/11] Test run cypress --- e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/appUpdateDetails.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/package.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/policies.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/task.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/user.cy.js | 2 +- e2e-tests/cypress/e2e/stepDefinitions/userRole.cy.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js index 11b144fe2..454b04f6f 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/appLaunch.cy.js @@ -4,7 +4,7 @@ let appData = ""; Given( "Admin logins successfully and lands on the home page of App panel", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); const dynamicData = { app_name: `app_${Math.floor(Math.random() * 10000)}`, //To create random text app_description: `app_${Math.floor(Math.random() * 10000)}`, //To create random text diff --git a/e2e-tests/cypress/e2e/stepDefinitions/appUpdateDetails.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/appUpdateDetails.cy.js index 7db79ad49..f668e7b92 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/appUpdateDetails.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/appUpdateDetails.cy.js @@ -6,7 +6,7 @@ const time_zone = "Africa/Accra"; const date_format = "04 October 2017"; const date_time_format = "04 October 2017 01:48 PM"; Given("Admin logins successfully and lands on the details view of App", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); // cy.visit("http://localhost:3000/platform/apps/"); cy.fixture("appData").then(function (data) { appData = data; diff --git a/e2e-tests/cypress/e2e/stepDefinitions/package.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/package.cy.js index 0206b8ced..870d3618a 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/package.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/package.cy.js @@ -3,7 +3,7 @@ import appPanelPageObjects from "../../support/pageObjectModel/appPanelPageObjec let appData = ""; Given("User navigates to Package tab", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); cy.fixture("appData").then(function (data) { appData = data; cy.log(appData); diff --git a/e2e-tests/cypress/e2e/stepDefinitions/policies.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/policies.cy.js index be7629cc9..97d2801f9 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/policies.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/policies.cy.js @@ -3,7 +3,7 @@ import appPanelPageObjects from "../../support/pageObjectModel/appPanelPageObjec let appData = ""; Given("User navigates to policies tab", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); cy.fixture("appData").then(function (data) { appData = data; cy.log(appData); diff --git a/e2e-tests/cypress/e2e/stepDefinitions/task.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/task.cy.js index 0c737205c..2b4e6cf9f 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/task.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/task.cy.js @@ -3,7 +3,7 @@ import appPanelPageObjects from "../../support/pageObjectModel/appPanelPageObjec let appData = ""; Given("User navigates to task tab", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); cy.fixture("appData").then(function (data) { appData = data; cy.log(appData); diff --git a/e2e-tests/cypress/e2e/stepDefinitions/user.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/user.cy.js index 3e212e694..068c371ed 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/user.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/user.cy.js @@ -8,7 +8,7 @@ let userRole; Given( "Admin navigates to the user tab and gets the user data from fixture data", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); cy.fixture("userRoleData").then(function (data) { userRole = data; cy.fixture("appData").then(function (data) { diff --git a/e2e-tests/cypress/e2e/stepDefinitions/userRole.cy.js b/e2e-tests/cypress/e2e/stepDefinitions/userRole.cy.js index 7cad87571..7ca1f15d8 100644 --- a/e2e-tests/cypress/e2e/stepDefinitions/userRole.cy.js +++ b/e2e-tests/cypress/e2e/stepDefinitions/userRole.cy.js @@ -6,7 +6,7 @@ let appData = ""; Given( "Admin navigates to the user role tab and gets the user role data from fixture data", () => { - cy.login("zelthy@zelthy.com", "Zelthy@123"); + cy.login("platform_admin@zango.dev", "Zango@123"); // cy.visit("http://localhost:3000/platform/apps/"); cy.fixture("appData").then(function (data) { appData = data; From d63f84840104563562f7d75c09441fb5ee230637 Mon Sep 17 00:00:00 2001 From: devilsautumn Date: Thu, 1 Aug 2024 11:28:36 +0530 Subject: [PATCH 11/11] replaced reserved identifiers UID and GID --- .gitpod.yml | 4 ++-- deploy/dev.dockerfile | 8 ++++---- deploy/docker_compose.dev.yml | 8 ++++---- deploy/docker_compose.prod.yml | 8 ++++---- deploy/docker_compose.test.yml | 8 ++++---- deploy/prod.dockerfile | 8 ++++---- deploy/readme.md | 6 +++--- deploy/test.dockerfile | 8 ++++---- .../getting-started/installing-zelthy/docker.mdx | 6 +++--- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index c21d898d2..f573a7090 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -51,8 +51,8 @@ tasks: - name: Setup and start the project command: | cd /workspace/zango-sandbox/zango - export UID=$(id -u) - export GID=$(id -g) + export HOST_UID=$(id -u) + export HOST_GID=$(id -g) # Run the gp info --json containing workspace info like workspace_id, url info=$(gp info --json) diff --git a/deploy/dev.dockerfile b/deploy/dev.dockerfile index 11fe4a3c6..af9df7dc7 100644 --- a/deploy/dev.dockerfile +++ b/deploy/dev.dockerfile @@ -4,14 +4,14 @@ RUN apt update RUN apt-get install -y net-tools RUN apt install ffmpeg -y -ARG UID -ARG GID +ARG HOST_UID +ARG HOST_GID # Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions RUN apt update && \ apt install -y sudo && \ - groupadd -o -g $GID -r zango_user && \ - adduser --uid $UID --gid $GID --disabled-password --gecos "" zango_user && \ + groupadd -o -g $HOST_GID -r zango_user && \ + adduser --uid $HOST_UID --gid $HOST_GID --disabled-password --gecos "" zango_user && \ echo 'zango_user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers # Set the non-root user as the default user diff --git a/deploy/docker_compose.dev.yml b/deploy/docker_compose.dev.yml index 4be8b8132..4238c0eb5 100644 --- a/deploy/docker_compose.dev.yml +++ b/deploy/docker_compose.dev.yml @@ -24,8 +24,8 @@ services: context: . dockerfile: dev.dockerfile args: - - UID=${HOST_UID} - - GID=${HOST_GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} ports: - "8000:8000" depends_on: @@ -47,8 +47,8 @@ services: context: . dockerfile: dev.dockerfile args: - - UID=${HOST_UID} - - GID=${HOST_GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} worker -l info" volumes: - .:/zango/ diff --git a/deploy/docker_compose.prod.yml b/deploy/docker_compose.prod.yml index f5f60b58d..f9fa9438b 100644 --- a/deploy/docker_compose.prod.yml +++ b/deploy/docker_compose.prod.yml @@ -20,8 +20,8 @@ services: context: . dockerfile: prod.dockerfile args: - - UID=${UID} - - GID=${GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} ports: - "8000:8000" depends_on: @@ -58,8 +58,8 @@ services: context: . dockerfile: prod.dockerfile args: - - UID=${UID} - - GID=${GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} worker -l info" volumes: - .:/zango/ diff --git a/deploy/docker_compose.test.yml b/deploy/docker_compose.test.yml index a4b222fc9..ba2782fde 100644 --- a/deploy/docker_compose.test.yml +++ b/deploy/docker_compose.test.yml @@ -24,8 +24,8 @@ services: context: . dockerfile: test.dockerfile args: - - UID=${HOST_UID} - - GID=${HOST_GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} ports: - "8000:8000" depends_on: @@ -47,8 +47,8 @@ services: context: . dockerfile: test.dockerfile args: - - UID=${HOST_UID} - - GID=${HOST_GID} + - HOST_UID=${HOST_UID} + - HOST_GID=${HOST_GID} command: /bin/sh -c "cd ${PROJECT_NAME} && celery -A ${PROJECT_NAME} worker -l info" volumes: - .:/zango/ diff --git a/deploy/prod.dockerfile b/deploy/prod.dockerfile index 71fae8f4c..e600003bb 100644 --- a/deploy/prod.dockerfile +++ b/deploy/prod.dockerfile @@ -5,14 +5,14 @@ RUN pip install gunicorn RUN apt-get install -y net-tools RUN apt install ffmpeg -y -ARG UID -ARG GID +ARG HOST_UID +ARG HOST_GID # Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions RUN apt update && \ apt install -y sudo && \ - groupadd -o -g ${GID} -r zango_user && \ - adduser --uid $UID --gid $GID --disabled-password --gecos "" zango_user && \ + groupadd -o -g ${HOST_GID} -r zango_user && \ + adduser --uid $HOST_UID --gid $HOST_GID --disabled-password --gecos "" zango_user && \ echo 'zango_user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers # Set the non-root user as the default user diff --git a/deploy/readme.md b/deploy/readme.md index aa1c5fb4e..06e4d80a4 100644 --- a/deploy/readme.md +++ b/deploy/readme.md @@ -39,11 +39,11 @@ To begin using Zango through Docker installation, ensure that Docker and Docker - `--platform_username`: The user email of the platform user (Default: `platform_admin@zango.dev`). - `--platform_user_password`: The password for the platform user (Default: `Zango@123`). -5. Docker is started as a non root user, run the below commands to export the host UID and GID +5. Docker is started as a non root user, run the below commands to export the host HOST_UID and HOST_GID ```bash -export UID=$(id -u) -export GID=$(id -g) +export HOST_UID=$(id -u) +export HOST_GID=$(id -g) ``` 6. Run `docker compose up` in the project directory to start the project diff --git a/deploy/test.dockerfile b/deploy/test.dockerfile index a117c7242..1ca322831 100644 --- a/deploy/test.dockerfile +++ b/deploy/test.dockerfile @@ -4,14 +4,14 @@ RUN apt update RUN apt-get install -y net-tools RUN apt install ffmpeg -y -ARG UID -ARG GID +ARG HOST_UID +ARG HOST_GID # Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions RUN apt update && \ apt install -y sudo && \ - groupadd -o -g $GID -r zango_user && \ - adduser --uid $UID --gid $GID --disabled-password --gecos "" zango_user && \ + groupadd -o -g $HOST_GID -r zango_user && \ + adduser --uid $HOST_UID --gid $HOST_GID --disabled-password --gecos "" zango_user && \ echo 'zango_user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers # Set the non-root user as the default user diff --git a/docs/docs/documentation/getting-started/installing-zelthy/docker.mdx b/docs/docs/documentation/getting-started/installing-zelthy/docker.mdx index e3805c766..e4801d172 100644 --- a/docs/docs/documentation/getting-started/installing-zelthy/docker.mdx +++ b/docs/docs/documentation/getting-started/installing-zelthy/docker.mdx @@ -41,11 +41,11 @@ To begin using Zango through Docker installation, ensure that Docker and Docker 5. Navigate to ``project_dir`` to start the project. -6. Docker is started as a non root user, run the below commands to export the host UID and GID +6. Docker is started as a non root user, run the below commands to export the host HOST_UID and HOST_GID ```bash -export UID=$(id -u) -export GID=$(id -g) +export HOST_UID=$(id -u) +export HOST_GID=$(id -g) ``` 7. Run `docker compose up` in the project directory to start the project