Files
netbird-kubernetes-operator/pkg/version/version_test.go
T
Philip LaineandGitHub 10f40da0e7 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 -->
2026-06-23 14:50:47 +02:00

35 lines
789 B
Go

// 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)
}