-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: prepare for merging main into this branch * chore: changes added as a draft to fix an issue * fix: the service path & prefixes * fix: applied the requested changes * chore: applied the requested changes * feat: add host added to instance * Update pkg/traefik/traefik.go Co-authored-by: Jose Ramon Mañes <[email protected]> * fix: bittwister tests using the proxy * refactor(makefile): fix comments + update readme Signed-off-by: Jose Ramon Mañes <[email protected]> --------- Signed-off-by: Jose Ramon Mañes <[email protected]> Co-authored-by: Jose Ramon Mañes <[email protected]> Co-authored-by: Jose Ramon Mañes <[email protected]>
- Loading branch information
1 parent
997cee2
commit 931b66d
Showing
21 changed files
with
846 additions
and
169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,7 @@ | ||
test-basic: | ||
go test -v ./e2e/basic -timeout 120m | ||
|
||
test-basic-file-cache: | ||
go test -v ./e2e/basic -run=TestFileCache -count=1 -timeout 120m | ||
|
||
test-basic-folder-cache: | ||
go test -v ./e2e/basic -run=TestFolderCache -count=1 -timeout 120m | ||
|
||
test-bittwister-packetloss: | ||
KNUU_TIMEOUT=120m go test -v ./e2e/basic --run=TestBittwister_Packetloss -timeout 60m -count=1 | ||
|
||
test-bittwister-bandwidth: | ||
KNUU_TIMEOUT=120m go test -v ./e2e/basic --run=TestBittwister_Bandwidth -timeout 60m -count=1 | ||
|
||
test-bittwister-latency: | ||
KNUU_TIMEOUT=120m go test -v ./e2e/basic --run=TestBittwister_Latency -timeout 60m -count=1 | ||
|
||
test-bittwister-jitter: | ||
KNUU_TIMEOUT=120m go test -v ./e2e/basic --run=TestBittwister_Jitter -timeout 60m -count=1 | ||
|
||
test-all: | ||
KNUU_TIMEOUT=300m go test -v ./e2e/... -timeout 120m | ||
|
||
.PHONY: test-all test-basic test-basic-file-cache test-basic-folder-cache test-bittwister-packetloss test-bittwister-bandwidth test-bittwister-latency test-bittwister-jitter | ||
pkgs := $(shell go list ./...) | ||
run := . | ||
count := 1 | ||
|
||
test: | ||
KNUU_TIMEOUT=120m go test -v $(pkgs) -run $(run) -count=$(count) -timeout 120m | ||
.PHONY: test |
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
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,59 @@ | ||
package basic | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
"github.com/celestiaorg/knuu/pkg/knuu" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// TestReverseProxy is a test function that verifies the functionality of a reverse proxy setup. | ||
// It mainly tests the ability to reach to a service running in a sidecar like BitTwister. | ||
// It calls an endpoint of the service and checks if the response is as expected. | ||
func TestReverseProxy(t *testing.T) { | ||
t.Parallel() | ||
// Setup | ||
|
||
main, err := knuu.NewInstance("main") | ||
require.NoError(t, err, "Error creating instance") | ||
|
||
err = main.SetImage("alpine:latest") | ||
require.NoError(t, err, "Error setting image") | ||
|
||
err = main.SetCommand("sleep", "infinite") | ||
require.NoError(t, err, "Error executing command") | ||
|
||
require.NoError(t, main.Commit(), "Error committing instance") | ||
|
||
t.Cleanup(func() { | ||
if os.Getenv("KNUU_SKIP_CLEANUP") == "true" { | ||
t.Log("Skipping cleanup") | ||
return | ||
} | ||
|
||
require.NoError(t, main.Destroy(), "Error destroying instance") | ||
}) | ||
|
||
require.NoError(t, main.EnableBitTwister(), "Error enabling BitTwister") | ||
require.NoError(t, main.Start(), "Error starting main instance") | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) | ||
defer cancel() | ||
|
||
require.NoError(t, main.BitTwister.WaitForStart(ctx), "Error waiting for BitTwister to start") | ||
|
||
// test if BitTwister running in a sidecar is accessible | ||
err = main.SetBandwidthLimit(1000) | ||
assert.NoError(t, err, "Error setting bandwidth limit") | ||
|
||
// Check if the BitTwister service is set | ||
out, err := main.BitTwister.Client().AllServicesStatus() | ||
assert.NoError(t, err, "Error getting all services status") | ||
assert.GreaterOrEqual(t, len(out), 1, "No services found") | ||
assert.NotEmpty(t, out[0].Name, "Service name is empty") | ||
} |
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
Oops, something went wrong.