def test_fetch_with_upstream_umbrella_cached_mode(self): self.utils.checkout_trunk() umbrella_fetcher = UpstreamJiraUmbrellaFetcher( self.setup_args(force_mode=False), self.repo_wrapper, self.repo_wrapper, self.utils.jira_umbrella_data_dir, self.base_branch, ) # Run first, to surely have results pickled for this umbrella umbrella_fetcher.run() # Run again, with using cache umbrella_fetcher.run() output_dir = FileUtils.join_path(self.utils.jira_umbrella_data_dir, UPSTREAM_JIRA_ID) original_mod_dates = FileUtils.get_mod_dates_of_files( output_dir, *ALL_OUTPUT_FILES) self._verify_files_and_mod_dates(output_dir) # Since we are using non-force mode (cached mode), we expect the files untouched new_mod_dates = FileUtils.get_mod_dates_of_files( output_dir, *ALL_OUTPUT_FILES) self.assertDictEqual(original_mod_dates, new_mod_dates)
def test_fetch_with_upstream_umbrella_force_mode(self): self.utils.checkout_trunk() output_dir = FileUtils.join_path(self.utils.jira_umbrella_data_dir, UPSTREAM_JIRA_ID) original_mod_dates = FileUtils.get_mod_dates_of_files( output_dir, *ALL_OUTPUT_FILES) umbrella_fetcher = UpstreamJiraUmbrellaFetcher( self.setup_args(force_mode=True), self.repo_wrapper, self.repo_wrapper, self.utils.jira_umbrella_data_dir, self.base_branch, ) umbrella_fetcher.run() self._verify_files_and_mod_dates(output_dir) # Since we are using force-mode (non cached mode), we expect all files have a newer mod date new_mod_dates = FileUtils.get_mod_dates_of_files( output_dir, *ALL_OUTPUT_FILES) for file, mod_date in new_mod_dates.items(): self.assertTrue(mod_date > original_mod_dates[file], f"File has not been modified: {file}")