summaryrefslogtreecommitdiffstats
path: root/modules/sync/status_pool_test.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-05-31 04:57:17 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-31 16:57:17 +0800
commitbfb44f885468839259bc2ead999953cdd85654e1 (patch)
tree1b8b404133dad5ad4650d15a0a9acc6207fb916b /modules/sync/status_pool_test.go
parent0f5b399e351786254f48dc1e5ed3419c3153703f (diff)
downloadgitea-bfb44f885468839259bc2ead999953cdd85654e1.tar.gz
gitea-bfb44f885468839259bc2ead999953cdd85654e1.zip
Fix status table race condition (#1835)
Diffstat (limited to 'modules/sync/status_pool_test.go')
-rw-r--r--modules/sync/status_pool_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/sync/status_pool_test.go b/modules/sync/status_pool_test.go
index eef3ff6f4f..b388c50db2 100644
--- a/modules/sync/status_pool_test.go
+++ b/modules/sync/status_pool_test.go
@@ -18,6 +18,15 @@ func Test_StatusTable(t *testing.T) {
table.Start("xyz")
assert.True(t, table.IsRunning("xyz"))
+ assert.False(t, table.StartIfNotRunning("xyz"))
+ assert.True(t, table.IsRunning("xyz"))
+
+ table.Stop("xyz")
+ assert.False(t, table.IsRunning("xyz"))
+
+ assert.True(t, table.StartIfNotRunning("xyz"))
+ assert.True(t, table.IsRunning("xyz"))
+
table.Stop("xyz")
assert.False(t, table.IsRunning("xyz"))
}