Fix run artifact package download names
This commit is contained in:
@@ -190,6 +190,37 @@ func TestCoreServiceDistributionBuildRejectsPrematureSuccessAndCanRetryAfterUplo
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceRunDistributionDownloadUsesTargetPackageName(t *testing.T) {
|
||||
svc, session, instance := newDistributionTestFixture(t)
|
||||
distribution, err := svc.GenerateRunDistributionForSession(session, domain.RunDistributionGenerateRequest{
|
||||
ServerInstanceID: instance.ID,
|
||||
TargetOS: "windows",
|
||||
TargetArch: "amd64",
|
||||
IdempotencyKey: "idem-run-download-name",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("generate run distribution: %v", err)
|
||||
}
|
||||
payload := []byte("windows zipped run package")
|
||||
completeDistributionBuild(t, svc, distribution, payload)
|
||||
|
||||
reference, err := svc.OpenArtifactDownloadForSession(session, domain.ArtifactDownloadReferenceRequest{ArtifactID: distribution.ArtifactID})
|
||||
if err != nil {
|
||||
t.Fatalf("open run artifact download: %v", err)
|
||||
}
|
||||
if reference.Filename != "run-windows-amd64.zip" || reference.ContentType != "application/zip" {
|
||||
t.Fatalf("expected windows run package metadata, got %+v", reference)
|
||||
}
|
||||
|
||||
content, err := svc.ReadArtifactContentForSession(session, domain.ArtifactContentRequest{ArtifactID: distribution.ArtifactID, Limit: len(payload)})
|
||||
if err != nil {
|
||||
t.Fatalf("read run artifact content: %v", err)
|
||||
}
|
||||
if content.Filename != reference.Filename || content.ContentType != reference.ContentType {
|
||||
t.Fatalf("expected content metadata to match reference, reference=%+v content=%+v", reference, content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceRunDistributionRetryReusesPartialArtifact(t *testing.T) {
|
||||
svc, session, instance := newDistributionTestFixture(t)
|
||||
key, plainKey, err := svc.ensureActiveComponentKey(instance.ID, domain.DistributionComponentRun, "")
|
||||
|
||||
Reference in New Issue
Block a user