Skip to content

Commit

Permalink
Revert "Skus" (#97)
Browse files Browse the repository at this point in the history
* Revert "refactoring update to use already available info"

This reverts commit b243e22.

* Revert "fix assert compare issue"

This reverts commit 0ae5d70.

* Revert "Uncomment update test, and fix issue with upsert. Replace with insert/update"

This reverts commit 5121ba8.

* Revert "PR changes"

This reverts commit 7f6c88c.

* Revert "remove comment to self"

This reverts commit a08035d.

* Revert "Revert sqlboiled mistake"

This reverts commit 7dbdf4e.

* Revert "Skus, plus a small bug fix for bios config set list querying"

This reverts commit 97d2959.
  • Loading branch information
jakeschuurmans authored Aug 2, 2024
1 parent b243e22 commit 61ee781
Show file tree
Hide file tree
Showing 45 changed files with 91 additions and 13,666 deletions.
76 changes: 0 additions & 76 deletions db/migrations/00008_skus.sql

This file was deleted.

111 changes: 0 additions & 111 deletions internal/dbtools/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ var (
FixtureEventHistoryServer *models.Server
FixtureEventHistoryRelatedID uuid.UUID
FixtureEventHistories []*models.EventHistory

FixtureServerSku *models.ServerSku
FixtureServerSkuAuxDevices []*models.ServerSkuAuxDevice
FixtureServerSkuDisks []*models.ServerSkuDisk
FixtureServerSkuMemory []*models.ServerSkuMemory
FixtureServerSkuNics []*models.ServerSkuNic
)

func addFixtures(t *testing.T) error {
Expand Down Expand Up @@ -189,10 +183,6 @@ func addFixtures(t *testing.T) error {
return err
}

if err := setupServerSku(ctx, testDB); err != nil {
return err
}

// excluding Chuckles here since that server is deleted
FixtureServers = models.ServerSlice{FixtureNemo, FixtureDory, FixtureMarlin}
FixtureDeletedServers = models.ServerSlice{FixtureChuckles}
Expand Down Expand Up @@ -896,104 +886,3 @@ func setupConfigSet(ctx context.Context, db *sqlx.DB) error {

return nil
}

//nolint:gomnd
func setupServerSku(ctx context.Context, db *sqlx.DB) error {
auxDevices := []*models.ServerSkuAuxDevice{
{
Vendor: "Nvidia",
Model: "RTX 9090 TI",
DeviceType: "Dedicated GPU",
Details: []byte(`{}`),
},
{
Vendor: "Quantis",
Model: "PCIe-240M",
DeviceType: "Other",
Details: []byte(`{"slot": 1,"chip": "IDQ20MC1","entropy-bandwidth": 240000000}`),
},
}

disks := []*models.ServerSkuDisk{
{
Bytes: 100,
Protocol: "SATA",
Count: 2,
},
{
Bytes: 10000,
Protocol: "NVMe",
Count: 1,
},
{
Bytes: 2000000,
Protocol: "PCIE",
Count: 6,
},
}

memory := []*models.ServerSkuMemory{
{
Bytes: 50,
Count: 2,
},
{
Bytes: 500,
Count: 2,
},
}

nics := []*models.ServerSkuNic{
{
PortBandwidth: 1000001,
PortCount: 4,
},
}

sku := &models.ServerSku{
Name: "Cool Sku",
Version: "1.0",
Vendor: "CoolShop",
Chassis: "4U",
BMCModel: "1",
MotherboardModel: "Momboard 3000",
CPUVendor: "AMD",
CPUModel: "EPYC 9754S",
CPUCores: 128,
CPUHertz: 2250000000,
CPUCount: 2,
}

err := sku.Insert(ctx, db, boil.Infer())
if err != nil {
return err
}

err = sku.AddSkuServerSkuAuxDevices(ctx, db, true, auxDevices...)
if err != nil {
return err
}

err = sku.AddSkuServerSkuDisks(ctx, db, true, disks...)
if err != nil {
return err
}

err = sku.AddSkuServerSkuMemories(ctx, db, true, memory...)
if err != nil {
return err
}

err = sku.AddSkuServerSkuNics(ctx, db, true, nics...)
if err != nil {
return err
}

FixtureServerSkuAuxDevices = auxDevices
FixtureServerSkuDisks = disks
FixtureServerSkuMemory = memory
FixtureServerSkuNics = nics
FixtureServerSku = sku

return nil
}
6 changes: 0 additions & 6 deletions internal/dbtools/testtools.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ func cleanDB(t *testing.T) {
deleteFixture(ctx, t, models.BiosConfigComponents())
deleteFixture(ctx, t, models.BiosConfigSets())

deleteFixture(ctx, t, models.ServerSkuNics())
deleteFixture(ctx, t, models.ServerSkuMemories())
deleteFixture(ctx, t, models.ServerSkuDisks())
deleteFixture(ctx, t, models.ServerSkuAuxDevices())
deleteFixture(ctx, t, models.ServerSkus())

testDB.Exec("SET sql_safe_updates = true;")
}

Expand Down
Loading

0 comments on commit 61ee781

Please sign in to comment.