mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-15 23:06:38 +00:00
[client] Fix mgmProber interface to match unexported GetServerPublicKey (#5815)
Update the mgmProber interface to use HealthCheck() instead of the now-unexported GetServerPublicKey(), aligning with the changes in the management client API.
This commit is contained in:
@@ -41,7 +41,7 @@ const (
|
|||||||
|
|
||||||
// mgmProber is the subset of management client needed for URL migration probes.
|
// mgmProber is the subset of management client needed for URL migration probes.
|
||||||
type mgmProber interface {
|
type mgmProber interface {
|
||||||
GetServerPublicKey() (*wgtypes.Key, error)
|
HealthCheck() error
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ import (
|
|||||||
"github.com/netbirdio/netbird/util"
|
"github.com/netbirdio/netbird/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockMgmProber struct {
|
type mockMgmProber struct{}
|
||||||
key wgtypes.Key
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *mockMgmProber) GetServerPublicKey() (*wgtypes.Key, error) {
|
func (m *mockMgmProber) HealthCheck() error {
|
||||||
return &m.key, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockMgmProber) Close() error { return nil }
|
func (m *mockMgmProber) Close() error { return nil }
|
||||||
@@ -247,11 +245,7 @@ func TestWireguardPortDefaultVsExplicit(t *testing.T) {
|
|||||||
func TestUpdateOldManagementURL(t *testing.T) {
|
func TestUpdateOldManagementURL(t *testing.T) {
|
||||||
origProber := newMgmProber
|
origProber := newMgmProber
|
||||||
newMgmProber = func(_ context.Context, _ string, _ wgtypes.Key, _ bool) (mgmProber, error) {
|
newMgmProber = func(_ context.Context, _ string, _ wgtypes.Key, _ bool) (mgmProber, error) {
|
||||||
key, err := wgtypes.GenerateKey()
|
return &mockMgmProber{}, nil
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &mockMgmProber{key: key.PublicKey()}, nil
|
|
||||||
}
|
}
|
||||||
t.Cleanup(func() { newMgmProber = origProber })
|
t.Cleanup(func() { newMgmProber = origProber })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user