Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardChukwu committed Oct 29, 2024
1 parent 8b14757 commit 6e7a958
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions client/clientimpl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,35 @@ func createPackageTestCase(name string, downloadSrv *httptest.Server) packageTes
}
}

func TestUpdatePackages(t *testing.T) {

Check failure on line 1508 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

other declaration of TestUpdatePackages

Check failure on line 1508 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / build-and-test

other declaration of TestUpdatePackages

Check failure on line 1508 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / test-coverage

other declaration of TestUpdatePackages

downloadSrv := createDownloadSrv(t)

Check failure on line 1510 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

undefined: createDownloadSrv

Check failure on line 1510 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / build-and-test

undefined: createDownloadSrv

Check failure on line 1510 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / test-coverage

undefined: createDownloadSrv
defer downloadSrv.Close()

// A success case.
var tests []packageTestCase
tests = append(tests, createPackageTestCase("success", downloadSrv))

// A case when downloading the file fails because the URL is incorrect.
notFound := createPackageTestCase("downloadable file not found", downloadSrv)
notFound.available.Packages["package1"].File.DownloadUrl = downloadSrv.URL + "/notfound"
notFound.expectedStatus.Packages["package1"].Status = protobufs.PackageStatusEnum_PackageStatusEnum_InstallFailed
notFound.expectedStatus.Packages["package1"].ErrorMessage = "cannot download"
tests = append(tests, notFound)

// A case when OnPackagesAvailable callback returns an error.
errorOnCallback := createPackageTestCase("error on callback", downloadSrv)
errorOnCallback.expectedError = packageUpdateErrorMsg
errorOnCallback.errorOnCallback = true
tests = append(tests, errorOnCallback)

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
verifyUpdatePackages(t, test)
})
}
}

func TestUpdatePackages(t *testing.T) {

Check failure on line 1537 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

TestUpdatePackages redeclared in this block

Check failure on line 1537 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / build-and-test

TestUpdatePackages redeclared in this block

Check failure on line 1537 in client/clientimpl_test.go

View workflow job for this annotation

GitHub Actions / test-coverage

TestUpdatePackages redeclared in this block

// Create a download server and defer its closure.
Expand Down

0 comments on commit 6e7a958

Please sign in to comment.