@@ -191,7 +191,7 @@ func (mock caaMockDNS) LookupCAA(_ context.Context, domain string) ([]*dns.CAA,
191191}
192192
193193func TestCAATimeout (t * testing.T ) {
194- va , _ := setup (nil , 0 , "" , nil , caaMockDNS {})
194+ va , _ := setup (nil , "" , nil , caaMockDNS {})
195195
196196 params := & caaParams {
197197 accountURIID : 12345 ,
@@ -408,7 +408,7 @@ func TestCAAChecking(t *testing.T) {
408408 method := core .ChallengeTypeHTTP01
409409 params := & caaParams {accountURIID : accountURIID , validationMethod : method }
410410
411- va , _ := setup (nil , 0 , "" , nil , caaMockDNS {})
411+ va , _ := setup (nil , "" , nil , caaMockDNS {})
412412 va .accountURIPrefixes = []string {"https://letsencrypt.org/acct/reg/" }
413413
414414 for _ , caaTest := range testCases {
@@ -431,7 +431,7 @@ func TestCAAChecking(t *testing.T) {
431431}
432432
433433func TestCAALogging (t * testing.T ) {
434- va , _ := setup (nil , 0 , "" , nil , caaMockDNS {})
434+ va , _ := setup (nil , "" , nil , caaMockDNS {})
435435
436436 testCases := []struct {
437437 Name string
@@ -521,7 +521,7 @@ func TestCAALogging(t *testing.T) {
521521// TestIsCAAValidErrMessage tests that an error result from `va.IsCAAValid`
522522// includes the domain name that was being checked in the failure detail.
523523func TestIsCAAValidErrMessage (t * testing.T ) {
524- va , _ := setup (nil , 0 , "" , nil , caaMockDNS {})
524+ va , _ := setup (nil , "" , nil , caaMockDNS {})
525525
526526 // Call IsCAAValid with a domain we know fails with a generic error from the
527527 // caaMockDNS.
@@ -546,7 +546,7 @@ func TestIsCAAValidErrMessage(t *testing.T) {
546546// which do not have the necessary parameters to do CAA Account and Method
547547// Binding checks.
548548func TestIsCAAValidParams (t * testing.T ) {
549- va , _ := setup (nil , 0 , "" , nil , caaMockDNS {})
549+ va , _ := setup (nil , "" , nil , caaMockDNS {})
550550
551551 // Calling IsCAAValid without a ValidationMethod should fail.
552552 _ , err := va .IsCAAValid (ctx , & vapb.IsCAAValidRequest {
@@ -592,7 +592,7 @@ func (b caaBrokenDNS) LookupCAA(_ context.Context, domain string) ([]*dns.CAA, s
592592func TestDisabledMultiCAARechecking (t * testing.T ) {
593593 brokenRVA := setupRemote (nil , "broken" , caaBrokenDNS {}, "" , "" )
594594 remoteVAs := []RemoteVA {{brokenRVA , "broken" }}
595- va , _ := setup (nil , 0 , "local" , remoteVAs , nil )
595+ va , _ := setup (nil , "local" , remoteVAs , nil )
596596
597597 features .Set (features.Config {
598598 EnforceMultiCAA : false ,
@@ -671,7 +671,6 @@ func TestMultiCAARechecking(t *testing.T) {
671671
672672 testCases := []struct {
673673 name string
674- maxLookupFailures int
675674 domains string
676675 remoteVAs []RemoteVA
677676 expectedProbSubstring string
@@ -719,13 +718,31 @@ func TestMultiCAARechecking(t *testing.T) {
719718 {
720719 name : "functional localVA, 1 broken RVA, no CAA records" ,
721720 domains : "present-dns-only.com" ,
721+ localDNSClient : caaMockDNS {},
722+ expectedDiffLogSubstring : `RemoteSuccesses":2,"RemoteFailures":[{"VAHostname":"broken","Problem":{"type":"dns","detail":"While processing CAA for` ,
723+ remoteVAs : []RemoteVA {
724+ {brokenVA , brokenUA },
725+ {remoteVA , remoteUA },
726+ {remoteVA , remoteUA },
727+ },
728+ expectedLabels : prometheus.Labels {
729+ "operation" : opCAA ,
730+ "perspective" : allPerspectives ,
731+ "challenge_type" : string (core .ChallengeTypeDNS01 ),
732+ "problem_type" : "" ,
733+ "result" : pass ,
734+ },
735+ },
736+ {
737+ name : "functional localVA, 2 broken RVAs, no CAA records" ,
738+ domains : "present-dns-only.com" ,
722739 expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
723740 expectedProbType : probs .DNSProblem ,
724- expectedDiffLogSubstring : `RemoteSuccesses":2 ,"RemoteFailures":[{"VAHostname":"broken","Problem":{"type":"dns","detail":"While processing CAA for` ,
741+ expectedDiffLogSubstring : `RemoteSuccesses":1 ,"RemoteFailures":[{"VAHostname":"broken","Problem":{"type":"dns","detail":"While processing CAA for` ,
725742 localDNSClient : caaMockDNS {},
726743 remoteVAs : []RemoteVA {
727744 {brokenVA , brokenUA },
728- {remoteVA , remoteUA },
745+ {brokenVA , brokenUA },
729746 {remoteVA , remoteUA },
730747 },
731748 expectedLabels : prometheus.Labels {
@@ -776,15 +793,33 @@ func TestMultiCAARechecking(t *testing.T) {
776793 {
777794 name : "functional localVA, 1 broken RVA, CAA issue type present" ,
778795 domains : "present.com" ,
779- expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
780- expectedProbType : probs .DNSProblem ,
781796 expectedDiffLogSubstring : `RemoteSuccesses":2,"RemoteFailures":[{"VAHostname":"broken","Problem":{"type":"dns","detail":"While processing CAA for` ,
782797 localDNSClient : caaMockDNS {},
783798 remoteVAs : []RemoteVA {
784799 {brokenVA , brokenUA },
785800 {remoteVA , remoteUA },
786801 {remoteVA , remoteUA },
787802 },
803+ expectedLabels : prometheus.Labels {
804+ "operation" : opCAA ,
805+ "perspective" : allPerspectives ,
806+ "challenge_type" : string (core .ChallengeTypeDNS01 ),
807+ "problem_type" : "" ,
808+ "result" : pass ,
809+ },
810+ },
811+ {
812+ name : "functional localVA, 2 broken RVA, CAA issue type present" ,
813+ domains : "present.com" ,
814+ expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
815+ expectedProbType : probs .DNSProblem ,
816+ expectedDiffLogSubstring : `RemoteSuccesses":1,"RemoteFailures":[{"VAHostname":"broken","Problem":{"type":"dns","detail":"While processing CAA for` ,
817+ localDNSClient : caaMockDNS {},
818+ remoteVAs : []RemoteVA {
819+ {brokenVA , brokenUA },
820+ {brokenVA , brokenUA },
821+ {remoteVA , remoteUA },
822+ },
788823 expectedLabels : prometheus.Labels {
789824 "operation" : opCAA ,
790825 "perspective" : allPerspectives ,
@@ -831,8 +866,6 @@ func TestMultiCAARechecking(t *testing.T) {
831866 {
832867 name : "1 hijacked RVA, CAA issue type present" ,
833868 domains : "present.com" ,
834- expectedProbSubstring : "CAA record for present.com prevents issuance" ,
835- expectedProbType : probs .CAAProblem ,
836869 expectedDiffLogSubstring : `RemoteSuccesses":2,"RemoteFailures":[{"VAHostname":"hijacked","Problem":{"type":"caa","detail":"While processing CAA for` ,
837870 localDNSClient : caaMockDNS {},
838871 remoteVAs : []RemoteVA {
@@ -870,8 +903,6 @@ func TestMultiCAARechecking(t *testing.T) {
870903 {
871904 name : "1 hijacked RVA, CAA issuewild type present" ,
872905 domains : "satisfiable-wildcard.com" ,
873- expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
874- expectedProbType : probs .CAAProblem ,
875906 expectedDiffLogSubstring : `RemoteSuccesses":2,"RemoteFailures":[{"VAHostname":"hijacked","Problem":{"type":"caa","detail":"While processing CAA for` ,
876907 localDNSClient : caaMockDNS {},
877908 remoteVAs : []RemoteVA {
@@ -907,9 +938,8 @@ func TestMultiCAARechecking(t *testing.T) {
907938 },
908939 },
909940 {
910- name : "1 hijacked RVA, CAA issuewild type present, 1 failure allowed " ,
941+ name : "1 hijacked RVA, CAA issuewild type present" ,
911942 domains : "satisfiable-wildcard.com" ,
912- maxLookupFailures : 1 ,
913943 expectedDiffLogSubstring : `RemoteSuccesses":2,"RemoteFailures":[{"VAHostname":"hijacked","Problem":{"type":"caa","detail":"While processing CAA for` ,
914944 localDNSClient : caaMockDNS {},
915945 remoteVAs : []RemoteVA {
@@ -919,9 +949,8 @@ func TestMultiCAARechecking(t *testing.T) {
919949 },
920950 },
921951 {
922- name : "2 hijacked RVAs, CAA issuewild type present, 1 failure allowed " ,
952+ name : "2 hijacked RVAs, CAA issuewild type present" ,
923953 domains : "satisfiable-wildcard.com" ,
924- maxLookupFailures : 1 ,
925954 expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
926955 expectedProbType : probs .CAAProblem ,
927956 expectedDiffLogSubstring : `RemoteSuccesses":1,"RemoteFailures":[{"VAHostname":"hijacked","Problem":{"type":"caa","detail":"While processing CAA for` ,
@@ -933,9 +962,8 @@ func TestMultiCAARechecking(t *testing.T) {
933962 },
934963 },
935964 {
936- name : "3 hijacked RVAs, CAA issuewild type present, 1 failure allowed " ,
965+ name : "3 hijacked RVAs, CAA issuewild type present" ,
937966 domains : "satisfiable-wildcard.com" ,
938- maxLookupFailures : 1 ,
939967 expectedProbSubstring : "During secondary CAA checking: While processing CAA" ,
940968 expectedProbType : probs .CAAProblem ,
941969 expectedDiffLogSubstring : `RemoteSuccesses":0,"RemoteFailures":[{"VAHostname":"hijacked","Problem":{"type":"caa","detail":"While processing CAA for` ,
@@ -950,7 +978,7 @@ func TestMultiCAARechecking(t *testing.T) {
950978
951979 for _ , tc := range testCases {
952980 t .Run (tc .name , func (t * testing.T ) {
953- va , mockLog := setup (nil , tc . maxLookupFailures , localUA , tc .remoteVAs , tc .localDNSClient )
981+ va , mockLog := setup (nil , localUA , tc .remoteVAs , tc .localDNSClient )
954982 defer mockLog .Clear ()
955983
956984 // MultiCAAFullResults: false is inherently flaky because of the
@@ -971,12 +999,14 @@ func TestMultiCAARechecking(t *testing.T) {
971999 test .AssertNotError (t , err , "Should not have errored, but did" )
9721000
9731001 if tc .expectedProbSubstring != "" {
1002+ test .AssertNotNil (t , isValidRes .Problem , "IsCAAValidRequest returned nil problem, but should not have" )
9741003 test .AssertContains (t , isValidRes .Problem .Detail , tc .expectedProbSubstring )
9751004 } else if isValidRes .Problem != nil {
9761005 test .AssertBoxedNil (t , isValidRes .Problem , "IsCAAValidRequest returned a problem, but should not have" )
9771006 }
9781007
9791008 if tc .expectedProbType != "" {
1009+ test .AssertNotNil (t , isValidRes .Problem , "IsCAAValidRequest returned nil problem, but should not have" )
9801010 test .AssertEquals (t , string (tc .expectedProbType ), isValidRes .Problem .ProblemType )
9811011 }
9821012
@@ -1017,7 +1047,7 @@ func TestCAAFailure(t *testing.T) {
10171047 hs := httpSrv (t , expectedToken )
10181048 defer hs .Close ()
10191049
1020- va , _ := setup (hs , 0 , "" , nil , caaMockDNS {})
1050+ va , _ := setup (hs , "" , nil , caaMockDNS {})
10211051
10221052 err := va .checkCAA (ctx , dnsi ("reserved.com" ), & caaParams {1 , core .ChallengeTypeHTTP01 })
10231053 if err == nil {
0 commit comments