@@ -83,28 +83,26 @@ func TestIssuanceCertStorageFailed(t *testing.T) {
83
83
_ , err = db .ExecContext (ctx , `DROP TRIGGER IF EXISTS fail_ready` )
84
84
test .AssertNotError (t , err , "failed to drop trigger" )
85
85
86
- // Make a specific update to certificateStatus fail, for this test but not others.
86
+ // Make a specific insert into certificates fail, for this test but not others.
87
87
// To limit the effect to this one test, we make the trigger aware of a specific
88
- // hostname used in this test. Since the UPDATE to the certificateStatus table
88
+ // hostname used in this test. Since the INSERT to the certificates table
89
89
// doesn't include the hostname, we look it up in the issuedNames table, keyed
90
- // off of the serial being updated.
91
- // We limit this to UPDATEs that set the status to "good" because otherwise we
92
- // would fail to revoke the certificate later.
90
+ // off of the serial.
93
91
// NOTE: CREATE and DROP TRIGGER do not work in prepared statements. Go's
94
92
// database/sql will automatically try to use a prepared statement if you pass
95
93
// any arguments to Exec besides the query itself, so don't do that.
96
94
_ , err = db .ExecContext (ctx , `
97
95
CREATE TRIGGER fail_ready
98
- BEFORE UPDATE ON certificateStatus
96
+ BEFORE INSERT ON certificates
99
97
FOR EACH ROW BEGIN
100
98
DECLARE reversedName1 VARCHAR(255);
101
99
SELECT reversedName
102
100
INTO reversedName1
103
101
FROM issuedNames
104
102
WHERE serial = NEW.serial
105
103
AND reversedName LIKE "com.wantserror.%";
106
- IF NEW.status = "good" AND reversedName1 != "" THEN
107
- SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Pretend there was an error updating the certificateStatus ';
104
+ IF reversedName1 != "" THEN
105
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Pretend there was an error inserting into certificates ';
108
106
END IF;
109
107
END
110
108
` )
@@ -117,7 +115,7 @@ func TestIssuanceCertStorageFailed(t *testing.T) {
117
115
118
116
// ---- Test revocation by serial ----
119
117
revokeMeDomain := "revokeme.wantserror.com"
120
- // This should fail because the trigger prevented setting the certificate status to "ready"
118
+ // This should fail because the trigger prevented storing the final certificate.
121
119
_ , err = authAndIssue (nil , certKey , []acme.Identifier {{Type : "dns" , Value : revokeMeDomain }}, true , "" )
122
120
test .AssertError (t , err , "expected authAndIssue to fail" )
123
121
@@ -140,7 +138,7 @@ func TestIssuanceCertStorageFailed(t *testing.T) {
140
138
141
139
// ---- Test revocation by key ----
142
140
blockMyKeyDomain := "blockmykey.wantserror.com"
143
- // This should fail because the trigger prevented setting the certificate status to "ready"
141
+ // This should fail because the trigger prevented storing the final certificate.
144
142
_ , err = authAndIssue (nil , certKey , []acme.Identifier {{Type : "dns" , Value : blockMyKeyDomain }}, true , "" )
145
143
test .AssertError (t , err , "expected authAndIssue to fail" )
146
144
0 commit comments