mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-27 06:49:07 +01:00
Fix tests
This commit is contained in:
@@ -3,7 +3,7 @@ package server
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
nbdns "github.com/netbirdio/netbird/dns"
|
nbdns "github.com/netbirdio/netbird/dns"
|
||||||
"github.com/netbirdio/netbird/management/server/activity"
|
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||||
"github.com/netbirdio/netbird/route"
|
"github.com/netbirdio/netbird/route"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|||||||
@@ -165,6 +165,26 @@ type Store interface {
|
|||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoopEventStore implements the Store interface without doing any operations
|
||||||
|
type NoopEventStore struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save sets the Event.ID to 1
|
||||||
|
func (store *NoopEventStore) Save(event *Event) (*Event, error) {
|
||||||
|
event.ID = 1
|
||||||
|
return event, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns an empty list of events
|
||||||
|
func (store *NoopEventStore) Get(accountID string, offset, limit int, descending bool) ([]*Event, error) {
|
||||||
|
return []*Event{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close doesn't close anything
|
||||||
|
func (store *NoopEventStore) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Event represents a network/system activity event.
|
// Event represents a network/system activity event.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
// Timestamp of the event
|
// Timestamp of the event
|
||||||
|
|||||||
@@ -1,17 +1 @@
|
|||||||
package activity
|
package activity
|
||||||
|
|
||||||
type NoopEventStore struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (store *NoopEventStore) Save(event *Event) (*Event, error) {
|
|
||||||
event.ID = 1
|
|
||||||
return event, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (store *NoopEventStore) Get(accountID string, offset, limit int, descending bool) ([]*Event, error) {
|
|
||||||
return []*Event{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (store *NoopEventStore) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package server
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/netbirdio/netbird/management/server/activity"
|
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package server_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/netbirdio/netbird/management/server/activity"
|
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
nbdns "github.com/netbirdio/netbird/dns"
|
nbdns "github.com/netbirdio/netbird/dns"
|
||||||
"github.com/netbirdio/netbird/management/server/activity"
|
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"testing"
|
"testing"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/netbirdio/netbird/management/server/activity"
|
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||||
"github.com/netbirdio/netbird/route"
|
"github.com/netbirdio/netbird/route"
|
||||||
"github.com/rs/xid"
|
"github.com/rs/xid"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
Reference in New Issue
Block a user