Преглед изворни кода

test(pgp): temporary fix for random order test

jguer пре 4 година
родитељ
комит
182f4c7f6c

+ 2 - 2
pkg/pgp/.snapshots/TestCheckPgpKeys-Two_dummy_packages_requiring_the_same_key

@@ -1,5 +1,5 @@
 
-:: PGP keys need importing:
+
  -> ABAF11C65A2970B130ABE3C479BE3E4300411886, required by: dummy-1 (dummy-1 dummy-2)
 :: Importing keys with gpg...
-
+:: PGP keys need importing:

+ 2 - 2
pkg/pgp/.snapshots/TestCheckPgpKeys-_one_valid_key_not_yet_in_the_keyring

@@ -1,5 +1,5 @@
 
-:: PGP keys need importing:
+
  -> 487EACC08557AD082088DABA1EB2638FF56C0C53, required by: cower
 :: Importing keys with gpg...
-
+:: PGP keys need importing:

+ 2 - 2
pkg/pgp/.snapshots/TestCheckPgpKeys-one_already_in_keyring

@@ -1,5 +1,5 @@
 
-:: PGP keys need importing:
+
  -> C52048C0C0748FEE227D47A2702353E0F7E48EDB, required by: dummy-3
 :: Importing keys with gpg...
-
+:: PGP keys need importing:

+ 2 - 2
pkg/pgp/.snapshots/TestCheckPgpKeys-two_valid_keys_not_yet_in_the_keyring

@@ -1,6 +1,6 @@
 
-:: PGP keys need importing:
+
  -> 11E521D646982372EB577A1F8F0871F202119294, required by: libc++
  -> B6C8F98282B944E3B0D5C2530FC3042E345AD05D, required by: libc++
 :: Importing keys with gpg...
-
+:: PGP keys need importing:

+ 6 - 1
pkg/pgp/keys_test.go

@@ -9,6 +9,8 @@ import (
 	"os"
 	"path"
 	"regexp"
+	"sort"
+	"strings"
 	"testing"
 
 	gosrc "github.com/Morganamilo/go-srcinfo"
@@ -255,7 +257,10 @@ func TestCheckPgpKeys(t *testing.T) {
 				out, _ := ioutil.ReadAll(r)
 				os.Stdout = rescueStdout
 
-				cupaloy.SnapshotT(t, string(out))
+				splitLines := strings.Split(string(out), "\n")
+				sort.Strings(splitLines)
+
+				cupaloy.SnapshotT(t, strings.Join(splitLines, "\n"))
 				return
 			}
 			// Here, we want to see the error.