Add rm command to delete results
This commit is contained in:
parent
e6a67ca5aa
commit
47a2fbb88c
4 changed files with 61 additions and 0 deletions
|
|
@ -122,6 +122,9 @@ func DeleteResult(sess sqlbuilder.Database, resultID int64) error {
|
|||
var result Result
|
||||
res := sess.Collection("results").Find("result_id", resultID)
|
||||
if err := res.One(&result); err != nil {
|
||||
if err == db.ErrNoMoreRows {
|
||||
return err
|
||||
}
|
||||
log.WithError(err).Error("error in obtaining the result")
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/ooni/probe-cli/utils"
|
||||
db "upper.io/db.v3"
|
||||
)
|
||||
|
||||
func TestMeasurementWorkflow(t *testing.T) {
|
||||
|
|
@ -155,6 +156,11 @@ func TestDeleteResult(t *testing.T) {
|
|||
if totalMeasurements != 0 {
|
||||
t.Fatal("measurements should be zero")
|
||||
}
|
||||
|
||||
err = DeleteResult(sess, 20)
|
||||
if err != db.ErrNoMoreRows {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNetworkCreate(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue