@@ -85,10 +85,52 @@ def test_download_metadata_file(downloads_dir):
85
85
GARDENLINUX_RELEASE ,
86
86
GARDENLINUX_COMMIT_SHORT ,
87
87
S3_DOWNLOADS_DIR )
88
- os . path . isfile (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml" )
88
+ assert (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml" ). exists ( )
89
89
90
90
91
- def test_github_release_page (monkeypatch ):
91
+ def test_download_metadata_file_no_such_release (downloads_dir ):
92
+ s3_artifacts = S3Artifacts (GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME )
93
+ release = "0000.0"
94
+ commit = GARDENLINUX_COMMIT_SHORT
95
+ cname = CName ("aws-gardener_prod" , "amd64" , "{0}-{1}" .format (release , commit ))
96
+ with pytest .raises (IndexError ):
97
+ download_metadata_file (s3_artifacts ,
98
+ cname .cname ,
99
+ release ,
100
+ commit ,
101
+ S3_DOWNLOADS_DIR )
102
+ assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml" ).exists ()
103
+
104
+
105
+ def test_download_metadata_file_no_such_commit (downloads_dir ):
106
+ s3_artifacts = S3Artifacts (GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME )
107
+ release = GARDENLINUX_RELEASE
108
+ commit = "deadbeef"
109
+ cname = CName ("aws-gardener_prod" , "amd64" , "{0}-{1}" .format (release , commit ))
110
+ with pytest .raises (IndexError ):
111
+ download_metadata_file (s3_artifacts ,
112
+ cname .cname ,
113
+ release ,
114
+ commit ,
115
+ S3_DOWNLOADS_DIR )
116
+ assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml" ).exists ()
117
+
118
+
119
+ def test_download_metadata_file_no_such_release_and_commit (downloads_dir ):
120
+ s3_artifacts = S3Artifacts (GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME )
121
+ release = "0000.0"
122
+ commit = "deadbeef"
123
+ cname = CName ("aws-gardener_prod" , "amd64" , "{0}-{1}" .format (release , commit ))
124
+ with pytest .raises (IndexError ):
125
+ download_metadata_file (s3_artifacts ,
126
+ cname .cname ,
127
+ release ,
128
+ commit ,
129
+ S3_DOWNLOADS_DIR )
130
+ assert not (S3_DOWNLOADS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml" ).exists ()
131
+
132
+
133
+ def test_github_release_page (monkeypatch , downloads_dir ):
92
134
monkeypatch .setattr ("gardenlinux.github.__main__.Repo" , SubmoduleAsRepo )
93
135
import gardenlinux .github
94
136
0 commit comments