@@ -55,7 +55,7 @@ func TestNewFedoraRepoExtractorImpl(t *testing.T) {
5555 ctx := testctx .NewCtx ()
5656 mockDownloader := downloader_test .NewMockDownloader (ctrl )
5757
58- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
58+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
5959
6060 require .NoError (t , err )
6161 require .NotNil (t , extractor )
@@ -67,27 +67,17 @@ func TestNewFedoraRepoExtractorImplValidation(t *testing.T) {
6767 mockDownloader := downloader_test .NewMockDownloader (ctrl )
6868
6969 t .Run ("nil dryRunnable should fail" , func (t * testing.T ) {
70- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (nil , ctx .FS (), mockDownloader , testLookasideURI )
70+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (nil , ctx .FS (), mockDownloader )
7171 require .Error (t , err )
7272 require .Nil (t , extractor )
7373 })
7474 t .Run ("nil filesystem should fail" , func (t * testing.T ) {
75- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , nil , mockDownloader , testLookasideURI )
75+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , nil , mockDownloader )
7676 require .Error (t , err )
7777 require .Nil (t , extractor )
7878 })
7979 t .Run ("nil downloader should fail" , func (t * testing.T ) {
80- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), nil , testLookasideURI )
81- require .Error (t , err )
82- require .Nil (t , extractor )
83- })
84- t .Run ("empty lookaside URI should fail" , func (t * testing.T ) {
85- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , "" )
86- require .Error (t , err )
87- require .Nil (t , extractor )
88- })
89- t .Run ("lookaside URI missing placeholders should fail" , func (t * testing.T ) {
90- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , "missing-placeholders" )
80+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), nil )
9181 require .Error (t , err )
9282 require .Nil (t , extractor )
9383 })
@@ -98,7 +88,7 @@ func TestExtractSourcesFromRepo(t *testing.T) {
9888 ctx := testctx .NewCtx ()
9989 mockDownloader := downloader_test .NewMockDownloader (ctrl )
10090
101- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
91+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
10292 require .NoError (t , err )
10393
10494 require .NoError (t , ctx .FS ().MkdirAll (testRepoDir , testDirPerms ))
@@ -123,7 +113,7 @@ func TestExtractSourcesFromRepo(t *testing.T) {
123113 return afero .WriteFile (ctx .FS (), destPath , []byte ("test patch content" ), testFilePerms )
124114 })
125115
126- err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName )
116+ err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName , testLookasideURI )
127117 require .NoError (t , err )
128118}
129119
@@ -132,19 +122,31 @@ func TestExtractSourcesFromRepoValidation(t *testing.T) {
132122 ctx := testctx .NewCtx ()
133123 mockDownloader := downloader_test .NewMockDownloader (ctrl )
134124
135- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
125+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
136126 require .NoError (t , err )
137127
138128 t .Run ("empty repo dir" , func (t * testing.T ) {
139- err := extractor .ExtractSourcesFromRepo (context .Background (), "" , testPackageName )
129+ err := extractor .ExtractSourcesFromRepo (context .Background (), "" , testPackageName , testLookasideURI )
140130 require .Error (t , err )
141131 assert .Contains (t , err .Error (), "repository directory cannot be empty" )
142132 })
143133
134+ t .Run ("empty lookaside URI" , func (t * testing.T ) {
135+ err := extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName , "" )
136+ require .Error (t , err )
137+ assert .Contains (t , err .Error (), "lookaside base URI cannot be empty" )
138+ })
139+
140+ t .Run ("lookaside URI missing placeholders" , func (t * testing.T ) {
141+ err := extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName , "missing-placeholders" )
142+ require .Error (t , err )
143+ assert .Contains (t , err .Error (), "lookaside base URI is missing required placeholder" )
144+ })
145+
144146 t .Run ("missing sources file" , func (t * testing.T ) {
145147 require .NoError (t , ctx .FS ().MkdirAll (testEmptyRepoDir , 0o755 ))
146148
147- err := extractor .ExtractSourcesFromRepo (context .Background (), testEmptyRepoDir , testPackageName )
149+ err := extractor .ExtractSourcesFromRepo (context .Background (), testEmptyRepoDir , testPackageName , testLookasideURI )
148150 require .Error (t , err )
149151 assert .Contains (t , err .Error (), "failed to read sources file" )
150152 })
@@ -155,13 +157,13 @@ func TestExtractSourcesFromRepoInvalidFormats(t *testing.T) {
155157 ctx := testctx .NewCtx ()
156158 mockDownloader := downloader_test .NewMockDownloader (ctrl )
157159
158- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
160+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
159161 require .NoError (t , err )
160162
161163 require .NoError (t , ctx .FS ().MkdirAll (testInvalidDir , testDirPerms ))
162164 setupSourcesFile (t , ctx .FS (), testInvalidDir , testInvalidSourcesContent )
163165
164- err = extractor .ExtractSourcesFromRepo (context .Background (), testInvalidDir , testPackageName )
166+ err = extractor .ExtractSourcesFromRepo (context .Background (), testInvalidDir , testPackageName , testLookasideURI )
165167 require .Error (t , err )
166168 assert .Contains (t , err .Error (), "invalid format in sources file at line" )
167169}
@@ -171,7 +173,7 @@ func TestExtractSourcesFromRepoDownloadFailure(t *testing.T) {
171173 ctx := testctx .NewCtx ()
172174 mockDownloader := downloader_test .NewMockDownloader (ctrl )
173175
174- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
176+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
175177 require .NoError (t , err )
176178
177179 require .NoError (t , ctx .FS ().MkdirAll (testRepoDir , testDirPerms ))
@@ -181,7 +183,7 @@ func TestExtractSourcesFromRepoDownloadFailure(t *testing.T) {
181183 mockDownloader .EXPECT ().Download (gomock .Any (), gomock .Any (), gomock .Any ()).
182184 Return (downloadErr )
183185
184- err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName )
186+ err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName , testLookasideURI )
185187 require .Error (t , err )
186188 require .ErrorIs (t , err , downloadErr )
187189 assert .Contains (t , err .Error (), "failed to download sources" )
@@ -192,7 +194,7 @@ func TestExtractSourcesFromRepoHashMismatch(t *testing.T) {
192194 ctx := testctx .NewCtx ()
193195 mockDownloader := downloader_test .NewMockDownloader (ctrl )
194196
195- extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader , testLookasideURI )
197+ extractor , err := fedorasource .NewFedoraRepoExtractorImpl (ctx , ctx .FS (), mockDownloader )
196198 require .NoError (t , err )
197199
198200 require .NoError (t , ctx .FS ().MkdirAll (testRepoDir , testDirPerms ))
@@ -205,7 +207,7 @@ func TestExtractSourcesFromRepoHashMismatch(t *testing.T) {
205207 return afero .WriteFile (ctx .FS (), destPath , []byte ("wrong content" ), testFilePerms )
206208 })
207209
208- err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName )
210+ err = extractor .ExtractSourcesFromRepo (context .Background (), testRepoDir , testPackageName , testLookasideURI )
209211 require .Error (t , err )
210212 assert .Contains (t , err .Error (), "hash mismatch" )
211213}
0 commit comments