1df0d9a549
See https://twitter.com/browseyourlife/status/1265289044856123393 Signed-off-by: Michael Mayer <michael@liquidbytes.net>
35 lines
601 B
Go
35 lines
601 B
Go
package workers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
"github.com/photoprism/photoprism/internal/mutex"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPrism_Start(t *testing.T) {
|
|
conf := config.TestConfig()
|
|
|
|
worker := NewPrism(conf)
|
|
|
|
assert.IsType(t, &Prism{}, worker)
|
|
|
|
if err := mutex.PrismWorker.Start(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err := worker.Start(); err == nil {
|
|
t.Fatal("error expected")
|
|
}
|
|
|
|
mutex.PrismWorker.Stop()
|
|
|
|
if err := worker.Start(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err := worker.Start(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|