You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status_pool_test.go 638B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package sync
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func Test_StatusTable(t *testing.T) {
  9. table := NewStatusTable()
  10. assert.False(t, table.IsRunning("xyz"))
  11. table.Start("xyz")
  12. assert.True(t, table.IsRunning("xyz"))
  13. assert.False(t, table.StartIfNotRunning("xyz"))
  14. assert.True(t, table.IsRunning("xyz"))
  15. table.Stop("xyz")
  16. assert.False(t, table.IsRunning("xyz"))
  17. assert.True(t, table.StartIfNotRunning("xyz"))
  18. assert.True(t, table.IsRunning("xyz"))
  19. table.Stop("xyz")
  20. assert.False(t, table.IsRunning("xyz"))
  21. }