-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement container cleanup mechanism
From now, every container started using gnomock will have a sidecar container whose only purpose is to make sure it is cleaned up when the tests complete. To trigger the cleanup, send a request to /sync/:id. It will hang (make sure timeout is long enough). When tests complete, the program exits, and the request it released automatically, signaling the sidecar that it's time. After that, regardless of the success of container termination, cleaner process stops. If a user chooses to use `gnomock.Stop()` anyway, the sidecar will be terminated immediately. For that, sidecar id is now encoded into container id as returned to the user (both directly and over HTTP)
- Loading branch information
Showing
25 changed files
with
1,172 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ linters: | |
- gosec | ||
- interfacer | ||
- lll | ||
- maligned | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM golang:latest AS builder | ||
|
||
WORKDIR /cleaner/ | ||
ADD go.mod . | ||
ADD go.sum . | ||
RUN go mod download | ||
RUN go mod verify | ||
ADD . . | ||
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o /gnomock-cleaner . | ||
|
||
FROM scratch | ||
|
||
COPY --from=builder /gnomock-cleaner /gnomock-cleaner | ||
ENTRYPOINT ["/gnomock-cleaner"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/orlangure/gnomock/cmd/cleaner | ||
|
||
go 1.15 | ||
|
||
require github.com/orlangure/gnomock v0.10.1 |
Oops, something went wrong.