Fix Serialization Issue with 'isDefault' Field in DataFileRequest#262
Fix Serialization Issue with 'isDefault' Field in DataFileRequest#262Zakaria-Kofiro merged 8 commits intomasterfrom
Conversation
| + " from url " + url.toExternalForm()))); | ||
| FileUtils.copyURLToFile(url, dataFile); | ||
| if (dataFileRequest.isDefault() | ||
| if (dataFileRequest.isDefaultDataFile() |
There was a problem hiding this comment.
@Zakaria-Kofiro To unblock this change will resolve, but can we circle around with a follow-up ticket to rename the isDefaultDataFile property to something else?
Because this conditional upon reading is confusing because the conditional is saying:
- IF it is a default data file flag TRUE, but the data file name is NOT equal the default file name
csv-data.txt, then enter
It makes it seem like the two conditionals are contradicting, seems the isDefaultDataFile is actually is the number of data files equal to 1 based on https://github.com/intuit/Tank/blob/cefa8e5a720820970e1f49af1c3332d09d661cca/tank_vmManager/src/main/java/com/intuit/tank/perfManager/workLoads/JobManager.java#L302C27-L302C27
There was a problem hiding this comment.
Oh, it confused me as well. The workflow is that it checks if there's a single datafile (in JobManager), and if there is, sets the conditional isDefaultDataFile to true from the controller. It is then sent to each agent which checks (in APITestHarness) whether both the default data flag is true and makes sure that it doesn't share a name with the default file name csv-data.txt. That's because it then copies the content from the original file to csv-data.txt which is then referenced throughout the rest of the code as the default datafile. I do agree that we should rename this, and maybe even revisit the workflow itself to just use the original file.
Fix Serialization Issue with 'isDefault' Field in DataFileRequest
When Tank jobs are run with only one DataFile, that DataFile in turn becomes the default DataFile for the job. This allows functions like
#{ioFunctions.getCSVData(0)}to be used in scripts without the need to explicitly define which DataFile to pull from. This worked as intended until recently when it stopped setting single DataFiles as default, with the root cause of this issue being related to the serialization of theisDefaultfield. It was being serialized incorrectly todefaultand always had it's value set to it's default value offalsewhen it was initially sent to the agent astrue:This was fixed by updating the field to
isDefaultDataFileand setting the@JsonPropertyand@XmlElementannotations accordingly:Please make sure these check boxes are checked before submitting
mvn clean test -P default** PR review process **