cloud/shepherd/provider/equinix: fix data race
This directly accesses the map without using the lock. Adding that fixes
the data race
Change-Id: I7d7f8aa59cfa2d564d2702926b05831f7c7ffa87
Reviewed-on: https://review.monogon.dev/c/monogon/+/3770
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/cloud/shepherd/provider/equinix/initializer_test.go b/cloud/shepherd/provider/equinix/initializer_test.go
index 3100ad2..767ee29 100644
--- a/cloud/shepherd/provider/equinix/initializer_test.go
+++ b/cloud/shepherd/provider/equinix/initializer_test.go
@@ -119,6 +119,7 @@
HardwareReservationID: res.ID,
ProjectSSHKeys: []string{kid},
})
+ f.mu.Lock()
f.devices[dev.ID].Network = []*packngo.IPAddressAssignment{
{
IpAddressCommon: packngo.IpAddressCommon{
@@ -130,6 +131,7 @@
},
},
}
+ f.mu.Unlock()
err = sess.Transact(ctx, func(q *model.Queries) error {
machine, err := q.NewMachine(ctx)
if err != nil {