mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-03 04:50:11 +00:00
chore: integration test support
This commit is contained in:
parent
9300f92491
commit
4a1fb9244c
@ -1,4 +1,4 @@
|
||||
package integration
|
||||
package test
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
@ -169,7 +169,7 @@ type Logging interface {
|
||||
|
||||
func SpoofDPIContainer(port uint16, log Logging, proxyRunArgs []string) (testcontainers.Container, error) {
|
||||
ctx := context.Background()
|
||||
projectTar, err := MakeTar("../../", FilePredicateFn(func(i FileInfo) bool {
|
||||
projectTar, err := MakeTar("../", FilePredicateFn(func(i FileInfo) bool {
|
||||
if i.Info.IsDir() {
|
||||
return false
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
FROM golang:alpine as builder
|
||||
|
||||
WORKDIR /go
|
||||
COPY . .
|
||||
RUN go build -o spoof-dpi ./cmd/spoof-dpi/main.go
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=builder /go/bin/spoof-dpi .
|
||||
|
||||
ARG RUN_ARGS
|
||||
|
||||
ENTRYPOINT ["./spoof-dpi", "${RUN_ARGS}"]
|
@ -1,4 +1,4 @@
|
||||
package integration_test
|
||||
package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/xvzc/SpoofDPI/test/integration"
|
||||
)
|
||||
|
||||
type StdoutLogger struct {
|
||||
@ -20,9 +19,10 @@ func (*StdoutLogger) Printf(format string, args ...interface{}) {
|
||||
fmt.Fprintf(os.Stdout, format, args...)
|
||||
}
|
||||
|
||||
// TODO:
|
||||
func TestTest(t *testing.T) {
|
||||
port := uint16(rand2.IntN(65536-2000) + 2000)
|
||||
container, err := integration.SpoofDPIContainer(port, new(StdoutLogger), []string{"-debug"})
|
||||
container, err := SpoofDPIContainer(port, new(StdoutLogger), []string{"-debug"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
Loading…
Reference in New Issue
Block a user