Skip GCP tests if the GCP environment variables aren't set

This commit is contained in:
Daniel Milnes 2026-04-26 16:23:27 +01:00
commit 6521f0e9f9
Signed by untrusted user: thebeanogamer
GPG key ID: 1701097BBDD44D1B

View file

@ -24,6 +24,7 @@ from fedora_image_uploader import Uploader
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_image_filter(fixtures_dir):
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -66,6 +67,7 @@ def test_image_filter(fixtures_dir):
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_messages(fixtures_dir):
with open(os.path.join(fixtures_dir, "messages/rc_compose_40.json")) as fd:
msg = message.load_message(json.load(fd))
@ -138,6 +140,7 @@ def test_messages(fixtures_dir):
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_import_image(fixtures_dir):
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -252,6 +255,7 @@ def test_import_image(fixtures_dir):
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_promote_image_eln_rawhide():
"""Assert this is a no-op for eln and rawhide"""
consumer = Uploader()
@ -304,6 +308,7 @@ def test_promote_image_eln_rawhide():
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_needs_promotion():
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -365,6 +370,7 @@ def test_needs_promotion():
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_no_promotion():
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -417,6 +423,7 @@ def test_no_promotion():
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_cleanup_skips_unmanaged_images():
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -447,6 +454,7 @@ def test_cleanup_skips_unmanaged_images():
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_cleanup_rawhide():
consumer = Uploader()
handler = consumer.handlers["gcp"]
@ -507,6 +515,7 @@ def test_cleanup_rawhide():
},
},
)
@pytest.mark.skipif(not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"), reason="GCP tests require GCP credentials")
def test_cleanup_eol():
consumer = Uploader()
handler = consumer.handlers["gcp"]