diff --git a/integration_tests/management/network_map_db/pgsql/group_test.go b/integration_tests/management/network_map_db/pgsql/group_test.go index 3c5426741..07d8ecf1a 100644 --- a/integration_tests/management/network_map_db/pgsql/group_test.go +++ b/integration_tests/management/network_map_db/pgsql/group_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestXXX(t *testing.T) { +func TestGetGroups(t *testing.T) { ctx := context.TODO() s, err := networkmap_pgsql.NewPostgresqlStore(ctx, dsn) diff --git a/management/internals/network_map_db/db_store.go b/management/internals/network_map_db/db_store.go index 8dc16f734..5efa469f7 100644 --- a/management/internals/network_map_db/db_store.go +++ b/management/internals/network_map_db/db_store.go @@ -18,7 +18,7 @@ const ( ) type NetworkMapDBStore interface { - GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, error) // TODO: join/populate peers + GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, error) GetPeers(ctx context.Context, accountId string) ([]nmdata.Peer, error) GetPolicies(ctx context.Context, accountId string) ([]nmdata.Policy, error) GetRoutes(ctx context.Context, accountId string) ([]nmdata.Route, error) diff --git a/management/internals/network_map_db/group.go b/management/internals/network_map_db/group.go deleted file mode 100644 index c307039f0..000000000 --- a/management/internals/network_map_db/group.go +++ /dev/null @@ -1,11 +0,0 @@ -package networkmapdb - -import ( - "context" - - "github.com/netbirdio/netbird/shared/management/networkmap/nmdata" -) - -func (db *NetworkMapDBStoreImpl) GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, error) { - return db.store.GetGroups(ctx, accountId) -} diff --git a/management/internals/network_map_db/pgsql/group_test.go b/management/internals/network_map_db/pgsql/group_test.go index e3f752d43..79f0ef00d 100644 --- a/management/internals/network_map_db/pgsql/group_test.go +++ b/management/internals/network_map_db/pgsql/group_test.go @@ -14,9 +14,6 @@ import ( "github.com/stretchr/testify/assert" ) -//go:embed test_db.sql -var initDb string - func TestGetGroups(t *testing.T) { ctx := context.TODO() diff --git a/management/internals/network_map_db/pgsql/test_db.sql b/management/internals/network_map_db/pgsql/test_db.sql deleted file mode 100644 index 5a8072ec5..000000000 --- a/management/internals/network_map_db/pgsql/test_db.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `accounts` (`id` text,`created_by` text,`created_at` datetime,`domain` text,`domain_category` text,`is_domain_primary_account` numeric,`network_identifier` text,`network_net` text,`network_dns` text,`network_serial` integer,`dns_settings_disabled_management_groups` text,`settings_peer_login_expiration_enabled` numeric,`settings_peer_login_expiration` integer,`settings_regular_users_view_blocked` numeric,`settings_groups_propagation_enabled` numeric,`settings_jwt_groups_enabled` numeric,`settings_jwt_groups_claim_name` text,`settings_jwt_allow_groups` text,`settings_extra_peer_approval_enabled` numeric,`settings_extra_integrated_validator_groups` text,PRIMARY KEY (`id`)); -CREATE TABLE `peers` (`id` text,`account_id` text,`key` text,`setup_key` text,`ip` text,`meta_hostname` text,`meta_go_os` text,`meta_kernel` text,`meta_core` text,`meta_platform` text,`meta_os` text,`meta_os_version` text,`meta_wt_version` text,`meta_ui_version` text,`meta_kernel_version` text,`meta_network_addresses` text,`meta_system_serial_number` text,`meta_system_product_name` text,`meta_system_manufacturer` text,`meta_environment` text,`meta_files` text,`name` text,`dns_label` text,`peer_status_last_seen` datetime,`peer_status_connected` numeric,`peer_status_login_expired` numeric,`peer_status_requires_approval` numeric,`user_id` text,`ssh_key` text,`ssh_enabled` numeric,`login_expiration_enabled` numeric,`last_login` datetime,`created_at` datetime,`ephemeral` numeric,`location_connection_ip` text,`location_country_code` text,`location_city_name` text,`location_geo_name_id` integer,PRIMARY KEY (`id`),CONSTRAINT `fk_accounts_peers_g` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)); -CREATE TABLE `groups` (`id` text,`account_id` text,`name` text,`issued` text,`peers` text,`integration_ref_id` integer,`integration_ref_integration_type` text,PRIMARY KEY (`id`),CONSTRAINT `fk_accounts_groups_g` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`)); - -INSERT INTO accounts VALUES('bf1c8084-ba50-4ce7-9439-34653001fc3b','edafee4e-63fb-11ec-90d6-0242ac120003','2024-10-02 16:01:38.210000+02:00','test.com','private',1,'af1c8024-ha40-4ce2-9418-34653101fc3c','{"IP":"100.64.0.0","Mask":"//8AAA=="}','',0,'[]',0,86400000000000,0,0,0,'',NULL,NULL,NULL); -INSERT INTO "groups" VALUES('cfefqs706sqkneg59g4g','bf1c8084-ba50-4ce7-9439-34653001fc3b','All','api','[]',0,''); -INSERT INTO "groups" VALUES('cfefqs706sqkneg59g3g','bf1c8084-ba50-4ce7-9439-34653001fc3b','AwesomeGroup1','api','[]',0,''); -INSERT INTO "groups" VALUES('cfefqs706sqkneg59g2g','bf1c8084-ba50-4ce7-9439-34653001fc3b','AwesomeGroup2','api','[]',0,'');