feat: report desktop release upload completion progress
This commit is contained in:
@@ -424,6 +424,41 @@ func TestDesktopClientReleaseDirectUploadRejectsSHA256Mismatch(t *testing.T) {
|
||||
require.Contains(t, err.Error(), "invalid_sha256")
|
||||
}
|
||||
|
||||
func TestDesktopClientReleaseDirectUploadCompleteJobReportsStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
content := []byte("release-package")
|
||||
sum := sha256.Sum256(content)
|
||||
sha256Hex := hex.EncodeToString(sum[:])
|
||||
objectKey := buildDesktopClientReleaseObjectKey(sha256Hex, "client.zip")
|
||||
storage := &desktopReleaseDownloadURLStorage{
|
||||
existsByKey: map[string]bool{objectKey: true},
|
||||
objects: map[string][]byte{objectKey: content},
|
||||
objectSizes: map[string]int64{objectKey: int64(len(content))},
|
||||
}
|
||||
svc := NewDesktopClientReleaseService(nil, storage, nil)
|
||||
|
||||
job := svc.StartDirectUploadCompleteJob(DesktopClientReleaseDirectUploadCompleteInput{
|
||||
Platform: "darwin",
|
||||
Arch: "arm64",
|
||||
Channel: "stable",
|
||||
Version: "1.2.3",
|
||||
Kind: DesktopClientAssetKindUpdater,
|
||||
OSSObjectKey: objectKey,
|
||||
FileName: "client.zip",
|
||||
FileSizeBytes: int64(len(content)),
|
||||
SHA256: sha256Hex,
|
||||
})
|
||||
require.NotEmpty(t, job.JobID)
|
||||
require.Equal(t, "running", job.Status)
|
||||
|
||||
require.Eventually(t, func() bool {
|
||||
current, err := svc.GetCompleteJob(job.JobID)
|
||||
require.NoError(t, err)
|
||||
return current.Status == "succeeded" && current.Result != nil && current.Result.SHA256 == sha256Hex
|
||||
}, time.Second, 10*time.Millisecond)
|
||||
}
|
||||
|
||||
type desktopReleaseDownloadURLStorage struct {
|
||||
publicURLCalls []string
|
||||
downloadURLCalls []string
|
||||
|
||||
Reference in New Issue
Block a user