Skip to content

Commit

Permalink
[#1553] Fix cycle import
Browse files Browse the repository at this point in the history
  • Loading branch information
fivitti committed Oct 29, 2024
1 parent 1d1e9a1 commit afe7a62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
8 changes: 7 additions & 1 deletion backend/server/database/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/go-pg/pg/v10"
"github.com/stretchr/testify/require"
"isc.org/stork/server/apps/kea"
dbops "isc.org/stork/server/database"
"isc.org/stork/server/database/maintenance"
dbmodel "isc.org/stork/server/database/model"
Expand Down Expand Up @@ -591,7 +592,12 @@ func TestMigration55LocalHostInDatabaseAndConfig(t *testing.T) {
}
}`)
require.NoError(t, err)
err = server.DetectReferences()

fec := &storktestdbmodel.FakeEventCenter{}
lookup := dbmodel.NewDHCPOptionDefinitionLookup()
app, _ := server.GetKea()

err = kea.CommitAppIntoDB(db, app, fec, nil, lookup)
require.NoError(t, err)

// Add a database host reservations.
Expand Down
15 changes: 0 additions & 15 deletions backend/server/database/model/test/keaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package dbmodeltest

import (
"github.com/go-pg/pg/v10"
"isc.org/stork/server/apps/kea"
dbmodel "isc.org/stork/server/database/model"
storktestdbmodel "isc.org/stork/server/test/dbmodel"
)

// A wrapper for a Kea daemon.
Expand Down Expand Up @@ -52,19 +50,6 @@ func (server *KeaServer) Configure(config string) error {
return dbmodel.UpdateDaemon(server.kea.machine.db, d)
}

// Detects the referenced objects i.e., subnets, shared networks, and hosts.
func (server *KeaServer) DetectReferences() error {
app, err := server.GetKea()
if err != nil {
return err
}

fec := &storktestdbmodel.FakeEventCenter{}
lookup := dbmodel.NewDHCPOptionDefinitionLookup()

return kea.CommitAppIntoDB(server.kea.machine.db, app, fec, nil, lookup)
}

// Returns a machine the Kea server belongs to.
func (server *KeaServer) GetMachine() (*dbmodel.Machine, error) {
return server.kea.GetMachine()
Expand Down

0 comments on commit afe7a62

Please sign in to comment.