ceph-csi/internal/util
Niels de Vos 68588dc7df util: fix unit-test for GetClusterMappingInfo()
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>
2021-08-25 16:08:48 +00:00
..
aws_metadata_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
aws_metadata.go cleanup: resolve godot linter 2021-07-13 06:50:03 +00:00
cephcmds.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
cephconf.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
cluster_mapping_test.go util: fix unit-test for GetClusterMappingInfo() 2021-08-25 16:08:48 +00:00
cluster_mapping.go util: fix unit-test for GetClusterMappingInfo() 2021-08-25 16:08:48 +00:00
conn_pool_test.go cleanup: modifies the error caused due to merged PRs 2021-07-22 18:15:48 +00:00
conn_pool.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
connection.go rbd: copy creds when copying the connection 2021-08-09 07:28:43 +00:00
credentials.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
crypto_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
crypto.go rbd: extract kmsID from volumeAttributes in RegenerateJournal() 2021-08-10 09:17:59 +00:00
cryptsetup.go rbd: add support to expand encrypted volume 2021-07-23 10:00:23 +00:00
csiconfig_test.go cleanup: resolves gofumpt issues of internal codes 2021-07-14 19:50:56 +00:00
csiconfig.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
errors_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
errors.go cleanup: fix mispell words 2020-11-29 12:47:46 +05:30
httpserver.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
idlocker_test.go util: remove deleteLock test as it is enforced by the controller 2021-07-22 15:07:49 +00:00
idlocker.go util: remove the deleteLock acquistion check for clone and snapshot 2021-07-22 15:07:49 +00:00
k8s.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
kms_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
kms.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
log.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
pidlimit_test.go cleanup: resolves gofumpt issues of internal codes 2021-07-14 19:50:56 +00:00
pidlimit.go util: getCgroupPidsFile produces striped path when extra : present 2021-08-03 06:03:10 +00:00
secretskms_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
secretskms.go cleanup: modifies the error caused due to merged PRs 2021-07-22 18:15:48 +00:00
stripsecrets.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
topology_test.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
topology.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
util_test.go cleanup: resolves gofumpt issues of internal codes 2021-07-14 19:50:56 +00:00
util.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
validate.go cleanup: resolve nlreturn linter issues 2021-07-22 06:05:01 +00:00
vault_sa_test.go util: allow configuring VAULT_AUTH_MOUNT_PATH for Vault Tenant SA KMS 2021-08-05 06:02:57 +00:00
vault_sa.go util: allow configuring VAULT_AUTH_MOUNT_PATH for Vault Tenant SA KMS 2021-08-05 06:02:57 +00:00
vault_test.go util: add vaultDestroyKeys option to destroy Vault kv-v2 secrets 2021-08-06 12:19:18 +00:00
vault_tokens_test.go util: add vaultDestroyKeys option to destroy Vault kv-v2 secrets 2021-08-06 12:19:18 +00:00
vault_tokens.go cleanup: use vaultDefaultCAVerify to set default value 2021-08-06 12:19:18 +00:00
vault.go util: add vaultDestroyKeys option to destroy Vault kv-v2 secrets 2021-08-06 12:19:18 +00:00
volid_test.go cleanup: addresses paralleltest linter 2021-06-25 11:55:12 +00:00
volid.go cleanup: resolves gofumpt issues of internal codes 2021-07-14 19:50:56 +00:00