Skip to content

Commit

Permalink
fixtures: update based on changes to structs, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed May 4, 2023
1 parent e3be6a3 commit abcafc6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 48 deletions.
2 changes: 1 addition & 1 deletion internal/fixtures/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type mockBMC struct {
}

// NewDeviceQueryor returns a mockBMC queryor that implements the DeviceQueryor interface
func NewDeviceQueryor(ctx context.Context, device *model.Device, logger *logrus.Entry) model.DeviceQueryor {
func NewDeviceQueryor(ctx context.Context, asset *model.Asset, logger *logrus.Entry) model.DeviceQueryor {
return &mockBMC{
hostPowerState: "on",
logger: logger,
Expand Down
14 changes: 7 additions & 7 deletions internal/fixtures/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import (
)

var (
Device1 = uuid.New()
Device2 = uuid.New()
Asset1ID = uuid.New()
Asset2ID = uuid.New()

Devices = map[string]model.Device{
Device1.String(): {
ID: Device1,
Assets = map[string]model.Asset{
Asset1ID.String(): {
ID: Asset1ID,
Vendor: "dell",
Model: "r6515",
BmcAddress: net.ParseIP("127.0.0.1"),
BmcUsername: "root",
BmcPassword: "hunter2",
},

Device2.String(): {
ID: Device2,
Asset2ID.String(): {
ID: Asset2ID,
Vendor: "dell",
Model: "r6515",
BmcAddress: net.ParseIP("127.0.0.2"),
Expand Down
32 changes: 16 additions & 16 deletions internal/fixtures/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import (
)

var (
Firmware = []model.Firmware{
Firmware = []*model.Firmware{
{
Version: "2.6.6",
URL: "https://dl.dell.com/FOLDER08105057M/1/BIOS_C4FT0_WN64_2.6.6.EXE",
FileName: "BIOS_C4FT0_WN64_2.6.6.EXE",
Model: "r6515",
Checksum: "1ddcb3c3d0fc5925ef03a3dde768e9e245c579039dd958fc0f3a9c6368b6c5f4",
ComponentSlug: "bios",
Version: "2.6.6",
URL: "https://dl.dell.com/FOLDER08105057M/1/BIOS_C4FT0_WN64_2.6.6.EXE",
FileName: "BIOS_C4FT0_WN64_2.6.6.EXE",
Models: []string{"r6515"},
Checksum: "1ddcb3c3d0fc5925ef03a3dde768e9e245c579039dd958fc0f3a9c6368b6c5f4",
Component: "bios",
},
{
Version: "DL6R",
URL: "https://downloads.dell.com/FOLDER06303849M/1/Serial-ATA_Firmware_Y1P10_WN32_DL6R_A00.EXE",
FileName: "Serial-ATA_Firmware_Y1P10_WN32_DL6R_A00.EXE",
Model: "r6515",
Checksum: "4189d3cb123a781d09a4f568bb686b23c6d8e6b82038eba8222b91c380a25281",
ComponentSlug: "drive",
Version: "DL6R",
URL: "https://downloads.dell.com/FOLDER06303849M/1/Serial-ATA_Firmware_Y1P10_WN32_DL6R_A00.EXE",
FileName: "Serial-ATA_Firmware_Y1P10_WN32_DL6R_A00.EXE",
Models: []string{"r6515"},
Checksum: "4189d3cb123a781d09a4f568bb686b23c6d8e6b82038eba8222b91c380a25281",
Component: "drive",
},
}
)

func copyFirmware(src []model.Firmware) []model.Firmware {
dst := []model.Firmware{}
func copyFirmware(src []*model.Firmware) []*model.Firmware {
dst := []*model.Firmware{}

copyOptions := copier.Option{IgnoreEmpty: true, DeepCopy: true}

Expand All @@ -39,6 +39,6 @@ func copyFirmware(src []model.Firmware) []model.Firmware {
return dst
}

func NewFirmware() []model.Firmware {
func NewFirmware() []*model.Firmware {
return copyFirmware(Firmware)
}
28 changes: 4 additions & 24 deletions internal/fixtures/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,7 @@ var (
PostCodeStatus: "",
},
},
ID: "NIC.Embedded.1",
Description: "Embedded NIC 1 Port 1 Partition 1",
SpeedBits: 6,
PhysicalID: "",
BusInfo: "",
MacAddress: "",
ID: "NIC.Embedded.1",
},
&common.NIC{
Common: common.Common{
Expand All @@ -440,12 +435,7 @@ var (
PostCodeStatus: "",
},
},
ID: "NIC.Slot.3",
Description: "NIC in Slot 3 Port 1 Partition 1",
SpeedBits: 100006,
PhysicalID: "",
BusInfo: "",
MacAddress: "F8:F2:1E:A0:0D:E0",
ID: "NIC.Slot.3",
},
},
Drives: []*common.Drive{
Expand Down Expand Up @@ -1241,12 +1231,7 @@ var (
PostCodeStatus: "",
},
},
ID: "NIC.Embedded.1",
Description: "Embedded NIC 1 Port 1 Partition 1",
SpeedBits: 6,
PhysicalID: "",
BusInfo: "",
MacAddress: "",
ID: "NIC.Embedded.1",
},
&common.NIC{
Common: common.Common{
Expand All @@ -1272,12 +1257,7 @@ var (
PostCodeStatus: "",
},
},
ID: "NIC.Slot.3",
Description: "NIC in Slot 3 Port 1 Partition 1",
SpeedBits: 100006,
PhysicalID: "",
BusInfo: "",
MacAddress: "F8:F2:1E:A0:0D:E0",
ID: "NIC.Slot.3",
},
},
Drives: []*common.Drive{
Expand Down

0 comments on commit abcafc6

Please sign in to comment.