@@ -23,7 +23,7 @@ type SNISuite struct {
2323
2424var _ = gc .Suite (& SNISuite {})
2525
26- func (s * SNISuite ) SetUpSuite (c * gc.C ) {
26+ func (s * SNISuite ) SetUpTest (c * gc.C ) {
2727 pki .DefaultKeyProfile = pkitest .OriginalDefaultKeyProfile
2828 authority , err := pkitest .NewTestAuthority ()
2929 c .Assert (err , jc .ErrorIsNil )
@@ -119,3 +119,21 @@ func (s *SNISuite) TestAuthorityTLSGetter(c *gc.C) {
119119 TLSCertificatesEqual (c , cert , leaf .TLSCertificate ())
120120 }
121121}
122+
123+ func (s * SNISuite ) TestNonExistantIPLeafReturnsDefault (c * gc.C ) {
124+ leaf , err := s .authority .LeafRequestForGroup (pki .DefaultLeafGroup ).
125+ AddDNSNames ("juju-app" ).
126+ Commit ()
127+ c .Assert (err , jc .ErrorIsNil )
128+
129+ helloRequest := & tls.ClientHelloInfo {
130+ ServerName : "" ,
131+ SignatureSchemes : []tls.SignatureScheme {tls .PSSWithSHA256 },
132+ SupportedVersions : []uint16 {tls .VersionTLS13 , tls .VersionTLS12 },
133+ }
134+
135+ cert , err := s .sniGetter (helloRequest )
136+ c .Assert (err , jc .ErrorIsNil )
137+
138+ TLSCertificatesEqual (c , cert , leaf .TLSCertificate ())
139+ }
0 commit comments