Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: metal-stack/metal-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0c1af362fa8edf1b6f7b43b625279ff11daa063e
Choose a base ref
..
head repository: metal-stack/metal-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f06a13dca628243a051924d27964f1881b9cca75
Choose a head ref
Showing with 8 additions and 6 deletions.
  1. +8 −6 cmd/metal-api/internal/datastore/migrations_integration/migrate_integration_test.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ package migrations_integration

import (
"context"
"fmt"
"log/slog"
"os"
"time"
@@ -142,6 +143,7 @@ func Test_MigrationChildPrefixLength(t *testing.T) {
log := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug}))

rs := datastore.New(log, c.IP+":"+c.Port, c.DB, c.User, c.Password)
// limit poolsize to speed up initialization
rs.VRFPoolRangeMin = 10000
rs.VRFPoolRangeMax = 10010
rs.ASNPoolRangeMin = 10000
@@ -205,18 +207,18 @@ func Test_MigrationChildPrefixLength(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, p)

nfetched, err := rs.FindNetworkByID(n1.ID)
n1fetched, err := rs.FindNetworkByID(n1.ID)
require.NoError(t, err)
require.NotNil(t, nfetched)
require.Equal(t, p1.PrivateNetworkPrefixLength, *nfetched.ChildPrefixLength)
require.NotNil(t, n1fetched)
require.Equal(t, p1.PrivateNetworkPrefixLength, *n1fetched.ChildPrefixLength, fmt.Sprintf("childprefixlength:%d", *n1fetched.ChildPrefixLength))

n2fetched, err := rs.FindNetworkByID(n2.ID)
require.NoError(t, err)
require.NotNil(t, n2fetched)
require.Equal(t, p1.PrivateNetworkPrefixLength, *n2fetched.ChildPrefixLength)
require.Equal(t, p2.PrivateNetworkPrefixLength, *n2fetched.ChildPrefixLength, fmt.Sprintf("childprefixlength:%d", *n2fetched.ChildPrefixLength))

n3fetched, err := rs.FindNetworkByID(n2.ID)
n3fetched, err := rs.FindNetworkByID(n3.ID)
require.NoError(t, err)
require.NotNil(t, n3fetched)
require.Nil(t, n2fetched.ChildPrefixLength)
require.Nil(t, n3fetched.ChildPrefixLength)
}