aboutsummaryrefslogtreecommitdiff
path: root/server/store
diff options
context:
space:
mode:
Diffstat (limited to 'server/store')
-rw-r--r--server/store/sqldb.go5
-rw-r--r--server/store/store_test.go3
2 files changed, 6 insertions, 2 deletions
diff --git a/server/store/sqldb.go b/server/store/sqldb.go
index de242eb..8ca34a9 100644
--- a/server/store/sqldb.go
+++ b/server/store/sqldb.go
@@ -145,7 +145,8 @@ func (db *sqlStore) List(includeExpired bool) ([]*CertRecord, error) {
// Revoke an issued cert by id.
func (db *sqlStore) Revoke(ids []string) error {
- if err := db.conn.Ping(); err != nil {
+ var err error
+ if err = db.conn.Ping(); err != nil {
return errors.Wrap(err, "unable to connect to database")
}
q, args, err := sqlx.In("UPDATE issued_certs SET revoked = 1 WHERE key_id IN (?)", ids)
@@ -153,7 +154,7 @@ func (db *sqlStore) Revoke(ids []string) error {
return err
}
q = db.conn.Rebind(q)
- _, err = db.conn.Query(q, args...)
+ _, err = db.conn.Exec(q, args...)
return err
}
diff --git a/server/store/store_test.go b/server/store/store_test.go
index 628c539..90a494e 100644
--- a/server/store/store_test.go
+++ b/server/store/store_test.go
@@ -93,6 +93,9 @@ func testStore(t *testing.T, db CertStorer) {
if err != nil {
t.Error(err)
}
+ if len(revoked) != 1 {
+ t.Errorf("Expected 1 revoked key, got %d", len(revoked))
+ }
for _, k := range revoked {
if k.KeyID != "key" {
t.Errorf("Unexpected key: %s", k.KeyID)