Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
TestPullFromAuthRe..: handle registry start/stop
Browse files Browse the repository at this point in the history
TestPullFromAuthRegistry executes the script to set up the registries
at the beginning and stop the registries at the end of the test.

Remove registry setup from semaphore
  • Loading branch information
darkowlzz committed May 31, 2021
1 parent bcc598b commit dfcebe8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ blocks:
- make ignite ignite-spawn ignited bin/amd64/Dockerfile GO_MAKE_TARGET=local
- make test
- make root-test
- bash e2e/util/setup-private-registry.sh # This is required for registry auth e2e tests.
- make e2e-nobuild # this depends on Semaphore CI's support for nested virtualization
21 changes: 21 additions & 0 deletions e2e/registry_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"testing"

Expand Down Expand Up @@ -41,6 +42,26 @@ const clientConfigContent = `
func TestPullFromAuthRegistry(t *testing.T) {
assert.Assert(t, e2eHome != "", "IGNITE_E2E_HOME should be set")

// Set up the registries.
startRegistries := exec.Command(
"bash", "util/setup-private-registry.sh",
)
startOutput, startErr := startRegistries.CombinedOutput()
if startErr != nil {
t.Fatalf("failed to set up registries: %v, %s", startErr, string(startOutput))
}

// Stop the registries at the end.
stopRegistries := exec.Command(
"docker", "stop",
"ignite-test-http-registry", "ignite-test-https-registry",
)
defer func() {
if stopOutput, stopErr := stopRegistries.CombinedOutput(); stopErr != nil {
t.Fatalf("failed to stop registries: %v, %s", stopErr, string(stopOutput))
}
}()

os.Setenv(containerd.InsecureRegistriesEnvVar, "http://127.5.0.1:5080,https://127.5.0.1:5443")
defer os.Unsetenv(containerd.InsecureRegistriesEnvVar)

Expand Down

0 comments on commit dfcebe8

Please sign in to comment.