mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
68588dc7df
Unit-testing often fails due to a race condition while writing the clusterMappingConfigFile from multiple go-routines at the same time. Failures from `make containerized-test` look like this: === CONT TestGetClusterMappingInfo/site2-storage_cluster-id_mapping cluster_mapping_test.go:153: GetClusterMappingInfo() = <nil>, expected data &[{map[site1-storage:site2-storage] [map[1:3]] [map[11:5]]} {map[site3-storage:site2-storage] [map[8:3]] [map[10:5]]}] === CONT TestGetClusterMappingInfo/site3-storage_cluster-id_mapping cluster_mapping_test.go:153: GetClusterMappingInfo() = <nil>, expected data &[{map[site3-storage:site2-storage] [map[8:3]] [map[10:5]]}] --- FAIL: TestGetClusterMappingInfo (0.01s) --- PASS: TestGetClusterMappingInfo/mapping_file_not_found (0.00s) --- PASS: TestGetClusterMappingInfo/mapping_file_found_with_empty_data (0.00s) --- PASS: TestGetClusterMappingInfo/cluster-id_mapping_not_found (0.00s) --- FAIL: TestGetClusterMappingInfo/site2-storage_cluster-id_mapping (0.00s) --- FAIL: TestGetClusterMappingInfo/site3-storage_cluster-id_mapping (0.00s) --- PASS: TestGetClusterMappingInfo/site1-storage_cluster-id_mapping (0.00s) By splitting the public GetClusterMappingInfo() function into an internal getClusterMappingInfo() that takes a filename, unit-testing can use different files for each go-routine, and testing becomes more predictable. Signed-off-by: Niels de Vos <ndevos@redhat.com> |
||
---|---|---|
.. | ||
aws_metadata_test.go | ||
aws_metadata.go | ||
cephcmds.go | ||
cephconf.go | ||
cluster_mapping_test.go | ||
cluster_mapping.go | ||
conn_pool_test.go | ||
conn_pool.go | ||
connection.go | ||
credentials.go | ||
crypto_test.go | ||
crypto.go | ||
cryptsetup.go | ||
csiconfig_test.go | ||
csiconfig.go | ||
errors_test.go | ||
errors.go | ||
httpserver.go | ||
idlocker_test.go | ||
idlocker.go | ||
k8s.go | ||
kms_test.go | ||
kms.go | ||
log.go | ||
pidlimit_test.go | ||
pidlimit.go | ||
secretskms_test.go | ||
secretskms.go | ||
stripsecrets.go | ||
topology_test.go | ||
topology.go | ||
util_test.go | ||
util.go | ||
validate.go | ||
vault_sa_test.go | ||
vault_sa.go | ||
vault_test.go | ||
vault_tokens_test.go | ||
vault_tokens.go | ||
vault.go | ||
volid_test.go | ||
volid.go |