started moving pg-specific nmap tests to integration_tests/management/network_map_db/pgsql

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-07-31 12:29:35 +02:00
parent 2baeb4bc0d
commit 3b5c8e2298
15 changed files with 168 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ const (
)
func (pg *PgStore) GetAccountSettings(ctx context.Context, accountId string) (nmdata.AccountSettingsInfo, error) {
rows, err := pg.pool.Query(ctx, GetAccountSettingsQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetAccountSettingsQuery, accountId)
if err != nil {
return nmdata.AccountSettingsInfo{}, err
}

View File

@@ -26,7 +26,7 @@ const (
)
func (pg *PgStore) GetAccountZones(ctx context.Context, accountId string) ([]nmdata.CustomZone, error) {
rows, err := pg.pool.Query(ctx, GetAccountZonesQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetAccountZonesQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -24,7 +24,7 @@ const (
)
func (pg *PgStore) GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, error) {
rows, err := pg.pool.Query(ctx, GetGroupsQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetGroupsQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -25,7 +25,7 @@ func TestGetGroups(t *testing.T) {
// err = loadSQL(ctx, s.pool, initDb)
//assert.NoError(t, err)
_, err = s.pool.Query(ctx, "insert into groups (id, account_id, name, resources, public_id) VALUES('test-group-id-1','ck7bnf2t2r9s739pkug0','test-group-1', '[{\"ID\":\"cui7q2jl0ubs73d8qpi0\",\"Type\":\"host\"}]','public-id-1')")
_, err = s.Pool.Query(ctx, "insert into groups (id, account_id, name, resources, public_id) VALUES('test-group-id-1','ck7bnf2t2r9s739pkug0','test-group-1', '[{\"ID\":\"cui7q2jl0ubs73d8qpi0\",\"Type\":\"host\"}]','public-id-1')")
assert.NoError(t, err)
groups, err := s.GetGroups(ctx, "ck7bnf2t2r9s739pkug0") //"ckd7ee2fic3c73dtendg")

View File

@@ -20,7 +20,7 @@ const (
)
func (pg *PgStore) GetNameServerGroups(ctx context.Context, accountId string) ([]nmdata.NameServerGroup, error) {
rows, err := pg.pool.Query(ctx, GetNameserversQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetNameserversQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -20,7 +20,7 @@ const (
)
func (pg *PgStore) GetNetwork(ctx context.Context, accountId string) (nmdata.Network, error) {
rows, err := pg.pool.Query(ctx, GetNetworkQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetNetworkQuery, accountId)
if err != nil {
return nmdata.Network{}, err
}

View File

@@ -20,7 +20,7 @@ const (
)
func (pg *PgStore) GetNetworkResources(ctx context.Context, accountId string) ([]nmdata.NetworkResource, error) {
rows, err := pg.pool.Query(ctx, GetNetworkResourcesQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetNetworkResourcesQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -20,7 +20,7 @@ const (
)
func (pg *PgStore) GetNetworkRouters(ctx context.Context, accountId string) ([]nmdata.NetworkRouter, error) {
rows, err := pg.pool.Query(ctx, GetNetworkRouterQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetNetworkRouterQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -22,7 +22,7 @@ const (
)
func (pg *PgStore) GetPeers(ctx context.Context, accountId string) ([]nmdata.Peer, error) {
rows, err := pg.pool.Query(ctx, GetPeersQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetPeersQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -19,7 +19,7 @@ const (
var _ networkmapdb.NetworkMapDBStore = &PgStore{}
type PgStore struct {
pool *pgxpool.Pool
Pool *pgxpool.Pool
}
func NewPostgresqlStore(ctx context.Context, dsn string) (*PgStore, error) {
@@ -28,7 +28,7 @@ func NewPostgresqlStore(ctx context.Context, dsn string) (*PgStore, error) {
return nil, err
}
return &PgStore{pool: pool}, nil
return &PgStore{Pool: pool}, nil
}
func connectToPgDb(ctx context.Context, dsn string) (*pgxpool.Pool, error) {

View File

@@ -23,7 +23,7 @@ const (
)
func (pg *PgStore) GetPolicies(ctx context.Context, accountId string) ([]nmdata.Policy, error) {
rows, err := pg.pool.Query(ctx, GetPoliciesQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetPoliciesQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -19,7 +19,7 @@ const (
)
func (pg *PgStore) GetPostureChecks(ctx context.Context, accountId string) ([]nmdata.PostureChecks, error) {
rows, err := pg.pool.Query(ctx, GetPostureChecksQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetPostureChecksQuery, accountId)
if err != nil {
return nil, err
}

View File

@@ -22,7 +22,7 @@ const (
)
func (pg *PgStore) GetRoutes(ctx context.Context, accountId string) ([]nmdata.Route, error) {
rows, err := pg.pool.Query(ctx, GetRoutesQuery, accountId)
rows, err := pg.Pool.Query(ctx, GetRoutesQuery, accountId)
if err != nil {
return nil, err
}