-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add switch OS, switch search queries and better datastore tests. #416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it, but then we must first test this with released metal-hammer and metal-core
if len(macs) > 0 { | ||
macexpr := r.Expr(macs) | ||
|
||
q = q.Filter(func(row r.Term) r.Term { | ||
return macexpr.SetIntersection(row.Field("network_interfaces").Field("macAddress")).Count().Gt(1) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never used and also I integration-tested this, it's not working! I removed it.
@@ -123,12 +138,13 @@ func (rs *RethinkStore) SetVrfAtSwitches(m *metal.Machine, vrf string) ([]metal. | |||
} | |||
|
|||
func (rs *RethinkStore) ConnectMachineWithSwitches(m *metal.Machine) error { | |||
switches, err := rs.SearchSwitchesByPartition(m.PartitionID) | |||
switches, err := rs.ListSwitches() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually allowed because of the following reasoning:
This function is only called when registering a machine. Found out that m.PartitionID
is not set in the caller and always ""
, which effectively turns this into a ListSwitches
. The metal-hammer does not send this anymore, so I assume it's a leftover when we started calculating the partition in the metal-api.
) | ||
|
||
func TestRethinkStore_ConflictIsReturned(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now already covered in a switch test and will also be covered in all other tests if we start to test like this for the rest of the package. Hence removed.
@@ -85,31 +85,6 @@ func TestRethinkStore_db(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestRethinkStore_Mock(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is rather useless and also the linter does not like it, therefore removed.
Works on the mini-lab (switch registration plus machine provisioning), so it's compatible with the current metal-core and metal-hammer. No breaking API changes included. |
metalctl