Skip to content

Commit

Permalink
Allowing integrated tests to run without baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
cssherman committed Apr 10, 2024
1 parent 8a17acc commit 18aa1d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 5 additions & 6 deletions geos_ats_package/geos_ats/baseline_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def collect_baselines( bucket_name: str,
file_download_progress( {}, f"{bucket_name}/{blob_tar}", archive_name )
except Exception as e:
logger.error( f'Failed to download baseline from URL ({bucket_name}/{blob_tar})' )
logger.error( str( e ) )
logger.error( repr( e ) )
else:
# Download from GCP
try:
Expand All @@ -140,7 +140,7 @@ def collect_baselines( bucket_name: str,
blob.download_to_filename( archive_name )
except Exception as e:
logger.error( f'Failed to download baseline from GCP ({bucket_name}/{blob_tar})' )
logger.error( str( e ) )
logger.error( repr( e ) )

if os.path.isfile( archive_name ):
# Unpack new baselines
Expand All @@ -149,11 +149,10 @@ def collect_baselines( bucket_name: str,
shutil.unpack_archive( archive_name, baseline_path, format='gztar' )
logger.info( 'Finished fetching baselines!' )
except Exception as e:
logger.error( str( e ) )
logger.error( repr( e ) )
raise Exception( f'Failed to unpack baselines: {archive_name}' )

else:
logger.error( str( e ) )
raise Exception( f'Could not find baseline files to unpack: expected={archive_name}' )


Expand Down Expand Up @@ -195,7 +194,7 @@ def pack_baselines( archive_name: str, baseline_path: str, log_path: str = '' ):
logger.info( f'Created {archive_name}.tar.gz' )
except Exception as e:
logger.error( 'Failed to create baseline archive' )
logger.error( str( e ) )
logger.error( repr( e ) )


def upload_baselines( bucket_name: str, archive_name: str ):
Expand All @@ -221,7 +220,7 @@ def upload_baselines( bucket_name: str, archive_name: str ):

except Exception as e:
logger.error( 'Failed to upload baselines!' )
logger.error( str( e ) )
logger.error( repr( e ) )


def manage_baselines( options ):
Expand Down
7 changes: 6 additions & 1 deletion geos_ats_package/geos_ats/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ def main():
os.chdir( ats_root_dir )
os.makedirs( options.workingDir, exist_ok=True )
create_log_directory( options )
baseline_io.manage_baselines( options )
try:
baseline_io.manage_baselines( options )
except Exception as e:
logger.error( 'Failed to download/locate baselines... Continuing to run tests without them' )
logger.error( repr( e ) )
os.makedirs( options.baselineDir, exist_ok=True )

# Check the test configuration
from geos_ats import configuration_record
Expand Down

0 comments on commit 18aa1d9

Please sign in to comment.