mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 20:02:15 +01:00
huge refactoring
This commit is contained in:
@@ -1,48 +1,14 @@
|
||||
ARG GOLANG_VERSION
|
||||
FROM thecodingmachine/gotenberg:workspace
|
||||
|
||||
FROM golang:${GOLANG_VERSION}-stretch AS golang
|
||||
# Define our workding outside of $GOPATH (we're using go modules).
|
||||
USER gotenberg
|
||||
WORKDIR /gotenberg/tests
|
||||
|
||||
FROM thecodingmachine/gotenberg:base
|
||||
|
||||
# |--------------------------------------------------------------------------
|
||||
# | Common libraries
|
||||
# |--------------------------------------------------------------------------
|
||||
# |
|
||||
# | Libraries used in the build process of this image.
|
||||
# |
|
||||
|
||||
RUN apt-get install -y git gcc
|
||||
|
||||
# |--------------------------------------------------------------------------
|
||||
# | Golang
|
||||
# |--------------------------------------------------------------------------
|
||||
# |
|
||||
# | Installs Golang.
|
||||
# |
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
||||
RUN export PATH="/usr/local/go/bin:$PATH" &&\
|
||||
go version
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
||||
|
||||
# |--------------------------------------------------------------------------
|
||||
# | Final touch
|
||||
# |--------------------------------------------------------------------------
|
||||
# |
|
||||
# | Last instructions of this build.
|
||||
# |
|
||||
|
||||
# Define our working directory outside of $GOPATH (we're using go modules).
|
||||
WORKDIR /tests
|
||||
|
||||
# Copy our module dependencies definitions.
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
# Copy our code source.
|
||||
COPY --chown=gotenberg:gotenberg . .
|
||||
|
||||
# Install module dependencies.
|
||||
RUN go mod download
|
||||
RUN go mod download &&\
|
||||
go mod verify
|
||||
|
||||
ENTRYPOINT [ "build/tests/docker-entrypoint.sh" ]
|
||||
@@ -2,19 +2,33 @@
|
||||
|
||||
set -xe
|
||||
|
||||
# Make sure the user running the
|
||||
# tests is the Gotenberg user.
|
||||
CURRENT_USER=$(whoami)
|
||||
if [ "$CURRENT_USER" != "gotenberg" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start the PM2 processes
|
||||
# (Google Chrome headless & unoconv listener).
|
||||
go run github.com/thecodingmachine/gotenberg/test/cmd/pm2
|
||||
|
||||
# Run our tests.
|
||||
go test -race -cover ./...
|
||||
|
||||
# Testing PM2 processes launch separatly for avoiding
|
||||
# spending to much time on each tests depending on
|
||||
# them.
|
||||
go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeStart
|
||||
go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvStart
|
||||
#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeStart
|
||||
#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvStart
|
||||
|
||||
# Running others tests.
|
||||
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/config
|
||||
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/random
|
||||
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/standarderror
|
||||
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/timeout
|
||||
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/app/api
|
||||
#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/config
|
||||
#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/random
|
||||
#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/standarderror
|
||||
#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/timeout
|
||||
#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/app/api
|
||||
|
||||
# Finally testing processes shutdown.
|
||||
go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeShutdown
|
||||
go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvShutdown
|
||||
#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeShutdown
|
||||
#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvShutdown
|
||||
Reference in New Issue
Block a user