@@ -7,64 +7,9 @@ import (
77 "os"
88 "testing"
99
10- "github.com/google/go-cmp/cmp"
1110 "github.com/stretchr/testify/require"
12-
13- "github.com/carabiner-dev/signer/options"
1411)
1512
16- // TestEnsureDefaultSigstore checks that the default sigstore
17- // options match the first instance in the roots file.
18- func TestEnsureDefaultSigstore (t * testing.T ) {
19- conf , err := ParseRoots (options .DefaultRoots )
20- require .NoError (t , err )
21-
22- moded := options .DefaultSigstore
23- // Timestamp is not exposed in json :/
24- moded .Timestamp = false
25- moded .HideOIDCOptions = false
26-
27- conf .Roots [0 ].RootData = nil
28- require .Empty (t , cmp .Diff (conf .Roots [0 ].Sigstore , moded ))
29- }
30-
31- // TestDefaultRoots checks that the default roots are valid and that the first
32- // root is sign-capable
33- func TestDefaultRoots (t * testing.T ) {
34- t .Parallel ()
35- for _ , tt := range []struct {
36- name string
37- getRoots func (t * testing.T ) * SigstoreRoots
38- }{
39- {"top-level-file" , func (t * testing.T ) * SigstoreRoots {
40- t .Helper ()
41- roots , err := ParseRootsFile ("../sigstore-roots.json" )
42- require .NoError (t , err )
43- return roots
44- }},
45- {"options-embed" , func (t * testing.T ) * SigstoreRoots {
46- t .Helper ()
47- roots , err := ParseRoots (options .DefaultRoots )
48- require .NoError (t , err )
49- return roots
50- }},
51- } {
52- t .Run (tt .name , func (t * testing.T ) {
53- t .Parallel ()
54- roots := tt .getRoots (t )
55-
56- // Require at least one root
57- require .GreaterOrEqual (t , len (roots .Roots ), 1 )
58- require .NoError (t , roots .Roots [0 ].ValidateSigner ())
59-
60- // Verify all returned sets are valid
61- for _ , r := range roots .Roots {
62- require .NoError (t , r .Validate ())
63- }
64- })
65- }
66- }
67-
6813func TestParseRoots (t * testing.T ) {
6914 t .Parallel ()
7015 for _ , tt := range []struct {
0 commit comments