mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-17 12:19:07 +02:00
[client] Add unit tests for engine synchronization and Info flag copying
- Introduced tests for the Engine's handleSync method to verify behavior when SkipNetworkMapUpdate is true and when NetworkMap is nil. - Added a test for the Info struct to ensure correct copying of flag values from one instance to another, while preserving unrelated fields.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGrpcClient_LastNetworkMapSerial_SetGet(t *testing.T) {
|
||||
c := &GrpcClient{}
|
||||
|
||||
if got := c.getLastNetworkMapSerial(); got != 0 {
|
||||
t.Fatalf("initial serial should be 0, got %d", got)
|
||||
}
|
||||
|
||||
c.setLastNetworkMapSerial(123)
|
||||
if got := c.getLastNetworkMapSerial(); got != 123 {
|
||||
t.Fatalf("serial after set should be 123, got %d", got)
|
||||
}
|
||||
|
||||
// overwrite should work
|
||||
c.setLastNetworkMapSerial(5)
|
||||
if got := c.getLastNetworkMapSerial(); got != 5 {
|
||||
t.Fatalf("serial after overwrite should be 5, got %d", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user