Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: '1.26.x'
cache: false
- name: Build containers
run: go tool mage -v docker:build
env:
Expand All @@ -49,6 +50,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -84,6 +86,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -125,6 +128,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: '1.26.x'
cache: false
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ jobs:
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
- name: golangci-lint
run: go tool mage go:lint
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -120,6 +122,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
id: go
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
cache: false
- name: Run tests in Docker
run: GO_VERSION=${{ matrix.version }} go tool mage -v test:docker
- name: Codecov upload
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: false
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
Expand Down
14 changes: 9 additions & 5 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ func (Test) Integration(ctx context.Context) error {
defer func() { <-sem }() // release

testName := strings.TrimSuffix(filepath.Base(testFile), ".py")
printf("=== RUN %s\n", testName)

start := time.Now()
testFileName := filepath.Base(testFile)
Expand Down Expand Up @@ -509,9 +510,12 @@ func (Test) Integration(ctx context.Context) error {
for i := 0; i < len(testFiles); i++ {
r := <-results
if r.err == nil {
printf("=== PASS: %s (%.2fs)\n", r.name, r.duration.Seconds())
printf("--- PASS: %s (%.2fs)\n", r.name, r.duration.Seconds())
} else if exitErr, ok := r.err.(*exec.ExitError); ok && exitErr.ExitCode() == 2 {
reason := strings.SplitN(strings.TrimSpace(string(r.stderr)), "\n", 2)[0]
printf("--- SKIP: %s (%.2fs) (%s)\n", r.name, r.duration.Seconds(), reason)
} else {
fmt.Printf("=== FAIL: %s (%.2fs)\n", r.name, r.duration.Seconds())
fmt.Printf("--- FAIL: %s (%.2fs)\n", r.name, r.duration.Seconds())
failed = append(failed, r)
}
}
Expand All @@ -520,7 +524,7 @@ func (Test) Integration(ctx context.Context) error {
if len(failed) > 0 {
fmt.Printf("\n--- FAILURES ---\n")
for _, r := range failed {
fmt.Printf("\n=== FAIL: %s (%.2fs)\n", r.name, r.duration.Seconds())
fmt.Printf("\n--- FAIL: %s (%.2fs)\n", r.name, r.duration.Seconds())
fmt.Printf("--- stdout ---\n")
os.Stdout.Write(r.stdout)
fmt.Printf("--- stderr ---\n")
Expand Down Expand Up @@ -578,7 +582,7 @@ func (Test) Single(ctx context.Context, name string) error {
elapsed := time.Since(start).Seconds()

if err == nil {
printf("=== PASS: %s (%.2fs)\n", name, elapsed)
printf("--- PASS: %s (%.2fs)\n", name, elapsed)
return nil
}

Expand All @@ -589,7 +593,7 @@ func (Test) Single(ctx context.Context, name string) error {
fmt.Printf("--- stderr ---\n")
os.Stdout.Write(stderr.Bytes())
}
fmt.Printf("=== FAIL: %s (%.2fs)\n", name, elapsed)
fmt.Printf("--- FAIL: %s (%.2fs)\n", name, elapsed)
if exitError, ok := err.(*exec.ExitError); ok {
return fmt.Errorf("integration test %s failed with exit code %d", name, exitError.ExitCode())
}
Expand Down
18 changes: 9 additions & 9 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,20 @@ def check_ed25519_support():
check_output('openssl genpkey -algorithm ed25519 -out {0}'.format(devnull),
shell=True, stderr=DEVNULL)
except Exception:
print_ok("SKIP (OpenSSL does not support ED25519)")
sys.exit(0)
print("OpenSSL does not support ED25519", file=sys.stderr)
sys.exit(2)

def check_keytool():
"""Skip the test if keytool is not available."""
if not shutil.which('keytool'):
print_ok("SKIP (keytool not available)")
sys.exit(0)
print("keytool not available", file=sys.stderr)
sys.exit(2)

def skip_on_windows(reason="not supported on Windows"):
"""Skip the test on Windows."""
if IS_WINDOWS:
print_ok("SKIP ({0})".format(reason))
sys.exit(0)
print(reason, file=sys.stderr)
sys.exit(2)

def reload_args():
"""Extra args to enable certificate reload on Windows via --timed-reload."""
Expand All @@ -389,7 +389,7 @@ def trigger_reload(ghostunnel):

def convert_p12_to_jceks(p12_name, jceks_name, password):
"""Convert a PKCS#12 keystore to JCEKS format using keytool.
Skips the test (sys.exit(0)) if the conversion fails."""
Skips the test (sys.exit(2)) if the conversion fails."""
try:
os.remove('{0}.jceks'.format(jceks_name))
except OSError:
Expand All @@ -400,8 +400,8 @@ def convert_p12_to_jceks(p12_name, jceks_name, password):
'-noprompt'.format(p12_name, jceks_name, password),
shell=True, stderr=DEVNULL)
if ret != 0:
print_ok("SKIP (keytool -importkeystore failed)")
sys.exit(0)
print("keytool -importkeystore failed", file=sys.stderr)
sys.exit(2)

def print_ok(msg):
print("\033[92m{0}\033[0m".format(msg))
Expand Down
4 changes: 2 additions & 2 deletions tests/test-client-systemd-socket-activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
ghostunnel = None

if not which('systemd-socket-activate'):
print_ok('skipping systemd socket activation test, no systemd-socket-activate binary found')
sys.exit(0)
print('no systemd-socket-activate binary found', file=sys.stderr)
sys.exit(2)

try:
# create certs
Expand Down
3 changes: 2 additions & 1 deletion tests/test-server-pkcs11-module.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
try:
# Only run PKCS11 tests if requested
if 'GHOSTUNNEL_TEST_PKCS11' not in os.environ:
sys.exit(0)
print('GHOSTUNNEL_TEST_PKCS11 not set', file=sys.stderr)
sys.exit(2)

test_keys = os.path.join(_ROOT_DIR, 'test-keys')
copyfile(os.path.join(test_keys, 'client-key.pem'), 'client.key')
Expand Down
Loading