Describe the bug
A clear and concise description of what the bug is.
Currently, flank always saves shards file in the current directory. This behavior can cause overriding this file when user run flank multiple times at the same time.
Expected behavior
A clear and concise description of what you expected to happen.
When we run tests we should save shards file to result directory. This behavior can cause overriding this file when user run flank multiple times at the same time.
Makes sense. Thanks for catching this.
Change save the location of shard.json file.
Currently, Flank always saves shards file in the current directory. This behavior can cause overriding this file when the user runs Flank multiple times at the same time.
The main goal is avoiding inconsistency between shard.json and results in case when Flank is executed multiple times at the same time.
Currently in dumpShards we using a ANDROID_SHARD_FILE and IOS_SHARD_FILE. This is the reason why Flank saves dump to execution directory.
private fun AndroidMatrixTestShards.saveShards(obfuscateOutput: Boolean) = saveShardChunks(
shardFilePath = ANDROID_SHARD_FILE,
shards = this,
size = size,
obfuscatedOutput = obfuscateOutput
)
fun IosArgs.dumpShards(
shardFilePath: String = IOS_SHARD_FILE,
)
The dump shard file should be saved to the current execution result directory.
private fun AndroidMatrixTestShards.saveShards(obfuscateOutput: Boolean) = saveShardChunks(
shardFilePath = Paths.get(path_to_result_dir,ANDROID_SHARD_FILE).toString(),toString(),
shards = this,
size = size,
obfuscatedOutput = obfuscateOutput
)
Flank should also check if the results directory currently exists and create if not.
Behavior should be similar to android
private fun IosArgs.dumpShardsIfXcTest() = takeIf { isXcTest }?.let {
createSHards().saveShardChunks(
shardFilePath = Paths.get(path_to_result_dir,IOS_SHARD_FILE).
shards = rawShards,
size = size,
obfuscatedOutput = obfuscateDumpShards
)
if (disableResultsUpload.not())
GcStorage.upload(IOS_SHARD_FILE, resultsBucket, resultsDir)
}
Flank was saving shards file to the current directory instead of the current execution result directory. This can cause inconsistency when Flank was used multiple at the same time.
The ticket is not blocked.
Ticket improve quality and reduce data inconsistency.
Dump shards file should be saved to result in directory instead of execution directory for android and ios.
android_shards.json fileios_shards.json file*_shards.json filedisable-results-upload set
Most helpful comment
#1475 Save shards.json in the results directory
Change save the location of
shard.jsonfile.Motivation
Currently, Flank always saves shards file in the current directory. This behavior can cause overriding this file when the user runs Flank multiple times at the same time.
Goals
The main goal is avoiding inconsistency between
shard.jsonand results in case when Flank is executed multiple times at the same time.Design
Currently in
dumpShardswe using aANDROID_SHARD_FILEandIOS_SHARD_FILE. This is the reason why Flank saves dump to execution directory.The dump shard file should be saved to the current execution result directory.
API
Android
Flank should also check if the results directory currently exists and create if not.
iOS
Behavior should be similar to
androidResults
Flank was saving
shardsfile to the current directory instead of the current execution result directory. This can cause inconsistency when Flank was used multiple at the same time.Dependencies
The ticket is not blocked.
Ticket improve quality and reduce data inconsistency.
Testing
Dump shards file should be saved to result in directory instead of execution directory for android and ios.
Android
android_shards.jsonfileiOS
ios_shards.jsonfiledisable-results-upload
*_shards.jsonfiledisable-results-uploadset