mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 18:59:09 +00:00
Add NetBird server to test connections (#328)
This change adds a NetBird server to the e2e test and ensures that cluster proxy peers can start and connect to the server. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Changes** * Updated the `ClusterProxy` `spec.apiServer` default to include a trailing `/` when omitted, aligning operator behavior with the Kubernetes in-cluster API URL. * **Documentation** * Refreshed the `ClusterProxySpec.apiServer` API reference to reflect the trailing `/` default. * **Tests** * Improved end-to-end coverage with a dynamically provisioned management URL, more robust readiness polling, and enhanced `ClusterProxy` validation. * **Chores** * Updated the end-to-end test Go configuration and CI to use the e2e-specific Go settings/toolchain. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
const (
|
||||
NetbirdClientImage = "ghcr.io/netbirdio/netbird:0.72.4@sha256:6c6c20baffae4a3ec50f29ec9361608a420625185505e8cd6f0c44d71c5d4798"
|
||||
KubeApiProxyImage = "ghcr.io/netbirdio/netbird-kubeapi-proxy:v0.0.4@sha256:bffa4f093abc19b4934ae37657bac76fa3b390cbd39aadac987634215eb750f5"
|
||||
)
|
||||
|
||||
func BuildVersion() string {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
modified := true
|
||||
for _, s := range bi.Settings {
|
||||
if s.Key == "vcs.modified" {
|
||||
if s.Value == "false" {
|
||||
modified = false
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
develVersion := "devel"
|
||||
if modified {
|
||||
return develVersion
|
||||
}
|
||||
if bi.Main.Version == "" {
|
||||
return develVersion
|
||||
}
|
||||
return bi.Main.Version
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/mod/modfile"
|
||||
|
||||
"github.com/go-openapi/testify/v2/require"
|
||||
)
|
||||
|
||||
func TestNetbirdClientImage(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
b, err := os.ReadFile("../../go.mod")
|
||||
require.NoError(t, err)
|
||||
f, err := modfile.Parse("go.mod", b, nil)
|
||||
require.NoError(t, err)
|
||||
idx := slices.IndexFunc(f.Require, func(r *modfile.Require) bool {
|
||||
return r.Mod.Path == "github.com/netbirdio/netbird"
|
||||
})
|
||||
require.GreaterT(t, idx, -1)
|
||||
modVersion := strings.TrimPrefix(f.Require[idx].Mod.Version, "v")
|
||||
|
||||
start := strings.Index(NetbirdClientImage, ":") + 1
|
||||
end := strings.Index(NetbirdClientImage, "@")
|
||||
imgVersion := NetbirdClientImage[start:end]
|
||||
|
||||
require.EqualT(t, modVersion, imgVersion)
|
||||
}
|
||||
Reference in New Issue
Block a user