mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-04 13:24:46 +00:00
chore: integration test support
This commit is contained in:
parent
9300f92491
commit
4a1fb9244c
@ -1,4 +1,4 @@
|
|||||||
package integration
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
@ -169,7 +169,7 @@ type Logging interface {
|
|||||||
|
|
||||||
func SpoofDPIContainer(port uint16, log Logging, proxyRunArgs []string) (testcontainers.Container, error) {
|
func SpoofDPIContainer(port uint16, log Logging, proxyRunArgs []string) (testcontainers.Container, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
projectTar, err := MakeTar("../../", FilePredicateFn(func(i FileInfo) bool {
|
projectTar, err := MakeTar("../", FilePredicateFn(func(i FileInfo) bool {
|
||||||
if i.Info.IsDir() {
|
if i.Info.IsDir() {
|
||||||
return false
|
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -10,7 +10,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/xvzc/SpoofDPI/test/integration"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type StdoutLogger struct {
|
type StdoutLogger struct {
|
||||||
@ -20,9 +19,10 @@ func (*StdoutLogger) Printf(format string, args ...interface{}) {
|
|||||||
fmt.Fprintf(os.Stdout, format, args...)
|
fmt.Fprintf(os.Stdout, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO:
|
||||||
func TestTest(t *testing.T) {
|
func TestTest(t *testing.T) {
|
||||||
port := uint16(rand2.IntN(65536-2000) + 2000)
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user