Skip to content

Commit

Permalink
FS-1234; Remove Serial
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed May 7, 2024
1 parent b7c9eb1 commit cd8682b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 33 deletions.
1 change: 0 additions & 1 deletion db/migrations/00002_config_sets.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ CREATE TABLE public.bios_config_components (
name STRING NOT NULL,
vendor STRING NOT NULL,
model STRING NOT NULL,
serial STRING NOT NULL,
created_at TIMESTAMPTZ NULL,
updated_at TIMESTAMPTZ NULL,
UNIQUE (fk_bios_config_set_id, name)
Expand Down
2 changes: 0 additions & 2 deletions internal/dbtools/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,11 @@ func setupConfigSet(ctx context.Context, db *sqlx.DB) error {
{
Name: "Fixture Test SM Motherboard",
Vendor: "SUPERMICRO",
Serial: "BIOS",
Model: "ATX",
},
{
Name: "Fixture Test Intel Network Adapter",
Vendor: "Intel",
Serial: "NIC",
Model: "PCIE",
},
}
Expand Down
11 changes: 2 additions & 9 deletions internal/models/bios_config_components.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/models/bios_config_components_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions pkg/api/v1/bios_config_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type BiosConfigComponent struct {
Name string `json:"name" binding:"required"`
Vendor string `json:"vendor"`
Model string `json:"model"`
Serial string `json:"serial"`
Settings []BiosConfigSetting `json:"settings" binding:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Expand All @@ -23,7 +22,6 @@ func (cc *BiosConfigComponent) toDBModelBiosConfigComponent() *models.BiosConfig
Name: cc.Name,
Vendor: cc.Vendor,
Model: cc.Model,
Serial: cc.Serial,
}

return dbcc
Expand All @@ -35,7 +33,6 @@ func (cc *BiosConfigComponent) fromDBModelBiosConfigComponent(component *models.
cc.Name = component.Name
cc.Vendor = component.Vendor
cc.Model = component.Model
cc.Serial = component.Serial
cc.CreatedAt = component.CreatedAt.Time
cc.UpdatedAt = component.CreatedAt.Time

Expand Down
2 changes: 0 additions & 2 deletions pkg/api/v1/bios_config_component_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type BiosConfigComponentQuery struct {
Name string `query:"name"`
Vendor string `query:"vendor"`
Model string `query:"model"`
Serial string `query:"serial"`
Settings []BiosConfigSettingQuery `query:"settings"`
}

Expand All @@ -22,7 +21,6 @@ func (cc *BiosConfigComponentQuery) queryMods(comparitor OperatorComparitorType)
mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Name, cc.Name)
mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Vendor, cc.Vendor)
mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Model, cc.Model)
mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Serial, cc.Serial)
mods = appendOperatorQueryMod(mods, comparitor, models.BiosConfigComponentTableColumns.Vendor, cc.Vendor)

for i := range cc.Settings {
Expand Down
14 changes: 6 additions & 8 deletions pkg/api/v1/bios_config_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var BiosConfigSetTest fleetdbapi.BiosConfigSet = fleetdbapi.BiosConfigSet{
{
Name: "SM Motherboard",
Vendor: "SUPERMICRO",
Serial: "BIOS",
Model: "ATX",
Settings: []fleetdbapi.BiosConfigSetting{
{
Expand All @@ -36,22 +35,21 @@ var BiosConfigSetTest fleetdbapi.BiosConfigSet = fleetdbapi.BiosConfigSet{
{
Name: "Intel Network Adapter",
Vendor: "Intel",
Serial: "NIC",
Model: "PCIE",
Settings: []fleetdbapi.BiosConfigSetting{
{
Key: "PXEEnable",
Value: "true",
Raw: []byte(`{}`),
Key: "PXEEnable",
Value: "true",
Raw: []byte(`{}`),
},
{
Key: "SRIOVEnable",
Value: "false",
},
{
Key: "position",
Value: "1",
Raw: []byte(`{ "lanes": 8 }`),
Key: "position",
Value: "1",
Raw: []byte(`{ "lanes": 8 }`),
},
},
},
Expand Down
13 changes: 6 additions & 7 deletions pkg/api/v1/router_bios_config_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ func TestIntegrationServerBiosConfigSetCreate(t *testing.T) {
})

var testCases = []struct {
testName string
testName string
BiosConfigSetName string
BiosConfigSetID string
expectedError bool
msgs []string
expectedError bool
msgs []string
}{
{
"config set router: config set create; success",
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestIntegrationServerBiosConfigSetGet(t *testing.T) {

var testCases = []struct {
testName string
BiosConfigSetID string
BiosConfigSetID string
expectedError bool
expectedResponse string
msg string
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestIntegrationServerBiosConfigSetDelete(t *testing.T) {

var testCases = []struct {
testName string
BiosConfigSetID string
BiosConfigSetID string
expectedError bool
expectedResponse string
msg string
Expand Down Expand Up @@ -318,7 +318,7 @@ func TestIntegrationServerBiosConfigSetUpdate(t *testing.T) {

var testCases = []struct {
testName string
BiosConfigSetID string
BiosConfigSetID string
expectedError bool
expectedResponse string
msg string
Expand Down Expand Up @@ -638,7 +638,6 @@ func assertBiosConfigComponentEqual(t *testing.T, expected *models.BiosConfigCom
assert.Equal(t, expected.Name, actual.Name)
assert.Equal(t, expected.Vendor, actual.Vendor)
assert.Equal(t, expected.Model, actual.Model)
assert.Equal(t, expected.Serial, actual.Serial)

assert.WithinDuration(t, expected.CreatedAt.Time, actual.CreatedAt, time.Second)
assert.WithinDuration(t, expected.UpdatedAt.Time, actual.UpdatedAt, time.Second)
Expand Down

0 comments on commit cd8682b

Please sign in to comment.