chore: 并入 iotlcm-bot 历史到 bot/(原提交 31dbc1d)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package state
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPrepareCreatesWritableSentDirectory(t *testing.T) {
|
||||
s := New(t.TempDir())
|
||||
if err := s.Prepare(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarkIsIdempotentForLookup(t *testing.T) {
|
||||
s := New(t.TempDir())
|
||||
sent, err := s.Has("run-1")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if sent {
|
||||
t.Fatal("run should not be marked before send")
|
||||
}
|
||||
if err := s.Mark("run-1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sent, err = s.Has("run-1")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !sent {
|
||||
t.Fatal("run should be marked")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user