mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-17 12:09:58 +00:00
Fix tests
This commit is contained in:
@@ -3,7 +3,7 @@ package server
|
||||
import (
|
||||
"fmt"
|
||||
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"
|
||||
"net"
|
||||
"reflect"
|
||||
|
||||
@@ -165,6 +165,26 @@ type Store interface {
|
||||
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.
|
||||
type Event struct {
|
||||
// Timestamp of the event
|
||||
|
||||
@@ -1,17 +1 @@
|
||||
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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/netbirdio/netbird/management/server/activity"
|
||||
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -2,7 +2,7 @@ package server_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/netbirdio/netbird/management/server/activity"
|
||||
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
@@ -2,7 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
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"
|
||||
"net/netip"
|
||||
"testing"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/netbirdio/netbird/management/server/activity"
|
||||
activity "github.com/netbirdio/netbird/management/server/activity/sqlite"
|
||||
"github.com/netbirdio/netbird/route"
|
||||
"github.com/rs/xid"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
Reference in New Issue
Block a user