chore: Re-introduce CLI test (#7268)

This commit is contained in:
Oli Juhl
2024-05-08 11:11:06 +02:00
committed by GitHub
parent 0f60d1fe96
commit 948458a43d
3 changed files with 92 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
name: "Test server" name: "Test server"
description: "Test the currently running medusa server to see if a user has been created and that the server is seeded" description: "Test the currently running medusa server to see if a user has been created"
inputs: inputs:
email: email:
@@ -10,10 +10,11 @@ inputs:
description: "password of user to log in" description: "password of user to log in"
required: false required: false
default: "password" default: "password"
pathToSeedData: # TODO: Add back seed test
description: "path to seed data" # pathToSeedData:
required: false # description: "path to seed data"
default: "../cli-test/data/seed.json" # required: false
# default: "../cli-test/data/seed.json"
runs: runs:
using: "composite" using: "composite"
@@ -24,9 +25,9 @@ runs:
- name: Log in with user - name: Log in with user
shell: "bash" shell: "bash"
run: ./integration-tests/scripts/cli/login.sh ${{ inputs.email }} ${{ inputs.password }} run: ./integration-tests/scripts/cli/login.sh ${{ inputs.email }} ${{ inputs.password }}
- name: GetProducts # - name: GetProducts
shell: "bash" # shell: "bash"
run: ./integration-tests/scripts/cli/get-products.sh ${{ inputs.pathToSeedData }} # run: ./integration-tests/scripts/cli/get-products.sh ${{ inputs.pathToSeedData }}
- name: Kill server - name: Kill server
shell: "bash" shell: "bash"

View File

@@ -1,90 +1,82 @@
#name: CLI Pipeline name: CLI Pipeline
#on: on:
# pull_request: pull_request:
#
#jobs: jobs:
# test-cli-with-database: test-cli-with-database:
# env: env:
# NODE_ENV: CI NODE_ENV: CI
# REDIS_URL: redis://localhost:6379 REDIS_URL: redis://localhost:6379
# DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test" DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
# services: POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
# redis: services:
# image: redis redis:
# Set health checks to wait until redis has started image: redis
# options: >- options: >-
# --health-cmd "redis-cli ping" --health-cmd "redis-cli ping"
# --health-interval 10s --health-interval 10s
# --health-timeout 5s --health-timeout 5s
# --health-retries 5 --health-retries 5
# ports: ports:
# - 6379:6379 - 6379:6379
#
# postgres: postgres:
# image: postgres image: postgres
# env: env:
# POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
# POSTGRES_USER: postgres POSTGRES_USER: postgres
# POSTGRES_DB: cli-test POSTGRES_DB: cli-test
# options: >- options: >-
# --health-cmd pg_isready --health-cmd pg_isready
# --health-interval 10s --health-interval 10s
# --health-timeout 5s --health-timeout 5s
# --health-retries 5 --health-retries 5
# ports: ports:
# - 5432:5432 - 5432:5432
#
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - name: Checkout - name: Checkout
# uses: actions/checkout@v3 uses: actions/checkout@v3
# with: with:
# fetch-depth: 0 fetch-depth: 0
#
# - name: Setup development server - name: Setup development server
# uses: ./.github/actions/setup-server uses: ./.github/actions/setup-server
# with: with:
# cache-extension: "cli-test" cache-extension: "cli-test"
# node-version: "16.14" node-version: "16.14"
#
# - name: Install Medusa cli - name: Install Medusa cli
# run: npm i -g @medusajs/medusa-cli run: npm i -g @medusajs/medusa-cli@preview
#
# - name: Create Medusa project - name: Create Medusa project
# run: | run: |
# medusa new cli-test --skip-db medusa new cli-test --skip-db --v2
# working-directory: .. working-directory: ..
#
# - name: run medusa dev - name: run medusa dev
# run: medusa-dev --force-install run: medusa-dev --force-install
# working-directory: ../cli-test working-directory: ../cli-test
#
# - name: Run migrations - name: Run migrations
# run: medusa migrations run run: medusa migrations run
# working-directory: ../cli-test working-directory: ../cli-test
#
# - name: Seed db - name: Create admin user
# run: yarn seed run: medusa user -e test@test.com -p password -i admin_123
# working-directory: ../cli-test working-directory: ../cli-test
#
# - name: Create admin user - name: Run development server
# run: medusa user -e test@test.com -p password -i admin_123 run: medusa develop &
# working-directory: ../cli-test working-directory: ../cli-test
#
# Test medusa develop - name: Testing development server
# uses: ./.github/actions/test-server
# - name: Run development server
# run: medusa develop & - name: Starting medusa
# working-directory: ../cli-test run: medusa start &
# working-directory: ../cli-test
# - name: Testing development server
# uses: ./.github/actions/test-server - name: Testing server
# uses: ./.github/actions/test-server
# Test medusa start
#
# - name: Starting medusa
# run: medusa start &
# working-directory: ../cli-test
#
# - name: Testing server
# uses: ./.github/actions/test-server

View File

@@ -5,7 +5,7 @@ status_code=$(curl \
-H "Content-Type: application/json"\ -H "Content-Type: application/json"\
-d '{"email":"'$1'", "password":"'$2'"}'\ -d '{"email":"'$1'", "password":"'$2'"}'\
--write-out %{http_code}\ --write-out %{http_code}\
http://localhost:9000/admin/auth) http://localhost:9000/auth/admin/emailpass)
if [[ "$status_code" -ne 200 ]] ; then if [[ "$status_code" -ne 200 ]] ; then
echo "Site status changed to $status_code" echo "Site status changed to $status_code"