added test docker file compouse and gitea workflow
This commit is contained in:
parent
e87f39e553
commit
6135f18ac0
@ -0,0 +1,21 @@
|
||||
name: Deploy
|
||||
run-name: ${{ gitea.actor }} build image and push to container registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'renew_tests'
|
||||
|
||||
jobs:
|
||||
CreateImage:
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||
with:
|
||||
runner: hubstaging
|
||||
secrets:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
DeployService:
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
|
||||
with:
|
||||
runner: hubstaging
|
||||
actionid: ${{ gitea.run_id }}
|
@ -1,7 +0,0 @@
|
||||
FROM golang:alpine
|
||||
WORKDIR /app
|
||||
RUN apk add git
|
||||
COPY . .
|
||||
RUN git config --global url."https://forgomod:glpat-uzHiaztQGzR1BL8RiQTK@penahub.gitlab.yandexcloud.net/".insteadOf "https://penahub.gitlab.yandexcloud.net/"
|
||||
RUN apk add --no-cache git && go mod download
|
||||
CMD ["go", "test", "./tests"]
|
@ -1,102 +1,29 @@
|
||||
version: '3'
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
test-postgres:
|
||||
image: postgres
|
||||
environment:
|
||||
POSTGRES_PASSWORD: Redalert2
|
||||
POSTGRES_USER: squiz
|
||||
POSTGRES_DB: squiz
|
||||
volumes:
|
||||
- test-postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- 35432:5432
|
||||
networks:
|
||||
- penatest
|
||||
healthcheck:
|
||||
test: pg_isready -U squiz
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 10
|
||||
|
||||
# need update!
|
||||
# test-pena-auth-service:
|
||||
# image: penahub.gitlab.yandexcloud.net:5050/pena-services/pena-auth-service:staging.872
|
||||
# container_name: test-pena-auth-service
|
||||
# init: true
|
||||
# env_file: auth.env.test
|
||||
# healthcheck:
|
||||
# test: wget -T1 --spider http://localhost:8000/user
|
||||
# interval: 2s
|
||||
# timeout: 2s
|
||||
# retries: 5
|
||||
# environment:
|
||||
# - DB_HOST=test-pena-auth-db
|
||||
# - DB_PORT=27017
|
||||
# - ENVIRONMENT=staging
|
||||
# - HTTP_HOST=0.0.0.0
|
||||
# - HTTP_PORT=8000
|
||||
# - DB_USERNAME=test
|
||||
# - DB_PASSWORD=test
|
||||
# - DB_NAME=admin
|
||||
# - DB_AUTH=admin
|
||||
# # ports:
|
||||
# # - 8000:8000
|
||||
# depends_on:
|
||||
# - test-pena-auth-db
|
||||
# # - pena-auth-migration
|
||||
# networks:
|
||||
# - penatest
|
||||
#
|
||||
# test-pena-auth-db:
|
||||
# container_name: test-pena-auth-db
|
||||
# init: true
|
||||
# image: "mongo:6.0.3"
|
||||
# command: mongod --quiet --logpath /dev/null
|
||||
# volumes:
|
||||
# - test-mongodb:/data/db
|
||||
# - test-mongoconfdb:/data/configdb
|
||||
# environment:
|
||||
# MONGO_INITDB_ROOT_USERNAME: test
|
||||
# MONGO_INITDB_ROOT_PASSWORD: test
|
||||
# # ports:
|
||||
# # - 27017:27017
|
||||
# networks:
|
||||
# - penatest
|
||||
|
||||
test-minio:
|
||||
container_name: test-minio
|
||||
init: true
|
||||
image: quay.io/minio/minio
|
||||
volumes:
|
||||
- test-minio:/data
|
||||
command: [ "minio", "--quiet", "server", "/data" ]
|
||||
networks:
|
||||
- penatest
|
||||
|
||||
test-squiz:
|
||||
container_name: test-squiz
|
||||
init: true
|
||||
app:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: TestsDockerfile
|
||||
depends_on:
|
||||
test-postgres:
|
||||
condition: service_healthy
|
||||
# test-pena-auth-service:
|
||||
# condition: service_healthy
|
||||
# volumes:
|
||||
# - ./../..:/app:ro
|
||||
# command: [ "go", "test", "./tests", "-run", "TestFoo" ]
|
||||
command: [ "go", "test", "-parallel", "1", "./tests" ]
|
||||
context: .
|
||||
dockerfile: testsDockerfile
|
||||
container_name: squiz-core-test-app
|
||||
environment:
|
||||
- IS_TEST=true
|
||||
- IS_PROD_LOG=false
|
||||
- IS_PROD=false
|
||||
- CLIENT_HTTP_URL=localhost:1488
|
||||
- GRPC_URL=localhost:9000
|
||||
- POSTGRES_URL=host=test-postgres port=35432 user=squiz password=Redalert2 dbname=squiz sslmode=disable
|
||||
- REDIS_HOST=test-redis:6379
|
||||
- REDIS_PASSWORD=admin
|
||||
- REDIS_DB=2
|
||||
- CLICKHOUSE_URL=clickhouse://clickhouse.pena:9000/default?sslmode=disable
|
||||
ports:
|
||||
- "1488:1488"
|
||||
- "9000:9000"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- penatest
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
penatest:
|
||||
|
||||
|
||||
volumes:
|
||||
test-minio:
|
||||
test-postgres:
|
||||
test-mongodb:
|
||||
test-mongoconfdb:
|
||||
app-network:
|
||||
driver: bridge
|
@ -24,8 +24,8 @@ import (
|
||||
|
||||
var validQuizIDForTestingClickHouse = 21211
|
||||
var PublicKey = `-----BEGIN PUBLIC KEY-----MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHgnvr7O2tiApjJfid1orFnIGm6980fZp+Lpbjo+NC/0whMFga2Biw5b1G2Q/B2u0tpO1Fs/E8z7Lv1nYfr5jx2S8x6BdA4TS2kB9Kf0wn0+7wSlyikHoKhbtzwXHZl17GsyEi6wHnsqNBSauyIWhpha8i+Y+3GyaOY536H47qyXAgMBAAE=-----END PUBLIC KEY-----`
|
||||
var postgresCred = "postgres://squiz:Redalert2@localhost:35432/squiz?sslmode=disable" //os.Getenv("POSTGRES_CRED")
|
||||
var baseURL = "http://127.0.0.1:1488" //os.Getenv("API_BASE_URL")
|
||||
var postgresCred = "postgres://squiz:Redalert2@10.7.0.2:35432/squiz?sslmode=disable" //os.Getenv("POSTGRES_CRED")
|
||||
var baseURL = "http://localhost:1488" //os.Getenv("API_BASE_URL")
|
||||
var validToken = CreateJWT(validUserID) // validUserID
|
||||
var expiredToken = CreateExpiredToken(validUserID)
|
||||
|
||||
|
7
testsDockerfile
Normal file
7
testsDockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM gitea.pena/penadevops/container-images/golang:main
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN go mod download
|
||||
RUN apk add tzdata curl
|
||||
|
||||
CMD go run ./cmd/main.go & sleep 30 && go test ./tests && kill %1
|
Loading…
Reference in New Issue
Block a user