|
| 1 | +// Copyright (c) Microsoft Corporation. |
| 2 | +// Use of this source code is governed by a BSD-style |
| 3 | +// license that can be found in the LICENSE file. |
| 4 | + |
| 5 | +package main |
| 6 | + |
| 7 | +import ( |
| 8 | + "strings" |
| 9 | + "testing" |
| 10 | + |
| 11 | + "github.com/microsoft/go/_util/supportdata" |
| 12 | +) |
| 13 | + |
| 14 | +func TestWindowsArchiveSignatures(t *testing.T) { |
| 15 | + table, branches := data() |
| 16 | + for i, version := range supported { |
| 17 | + for platform := range version.Platforms { |
| 18 | + if !strings.HasPrefix(platform, "windows-") { |
| 19 | + continue |
| 20 | + } |
| 21 | + t.Run(version.Number+"/"+platform, func(t *testing.T) { |
| 22 | + name := "go" + version.Number + "." + platform + ".zip" |
| 23 | + url := baseURL + name |
| 24 | + var artifact *supportdata.LatestLink |
| 25 | + for _, file := range branches[i].Files { |
| 26 | + if file.Filename == name && file.Kind == supportdata.Archive { |
| 27 | + artifact = file |
| 28 | + break |
| 29 | + } |
| 30 | + } |
| 31 | + if artifact == nil { |
| 32 | + t.Fatalf("Windows archive %q missing from branch metadata", name) |
| 33 | + } |
| 34 | + if artifact.URL != url || artifact.ChecksumURL != url+".sha256" { |
| 35 | + t.Errorf("archive or checksum URL changed: URL = %q, ChecksumURL = %q", artifact.URL, artifact.ChecksumURL) |
| 36 | + } |
| 37 | + if want := url + ".sig"; artifact.SignatureURL != want { |
| 38 | + t.Errorf("SignatureURL = %q, want %q", artifact.SignatureURL, want) |
| 39 | + } |
| 40 | + if link := "[" + signatureMsg + "](" + url + ".sig)"; !strings.Contains(table, link) { |
| 41 | + t.Errorf("download table missing signature link %q", link) |
| 42 | + } |
| 43 | + }) |
| 44 | + } |
| 45 | + } |
| 46 | +} |
0 commit comments