To make tests reproducible we sort the instance IDs in the map, and then get a random index via rnd.
(instances map[string]InstanceDesc, rnd *rand.Rand)
| 4562 | |
| 4563 | // To make tests reproducible we sort the instance IDs in the map, and then get a random index via rnd. |
| 4564 | func getRandomInstanceID(instances map[string]InstanceDesc, rnd *rand.Rand) string { |
| 4565 | instanceIDs := make([]string, 0, len(instances)) |
| 4566 | for id := range instances { |
| 4567 | instanceIDs = append(instanceIDs, id) |
| 4568 | } |
| 4569 | sort.Strings(instanceIDs) |
| 4570 | return instanceIDs[rnd.Intn(len(instanceIDs))] |
| 4571 | } |
| 4572 | |
| 4573 | type mockError struct { |
| 4574 | isClientErr bool |
no outgoing calls
no test coverage detected