[ARVADOS] updated: 5dd20e4a0aac7428a68dabbf5ec2c6800f32957b
git at public.curoverse.com
git at public.curoverse.com
Tue Aug 11 13:52:06 EDT 2015
Summary of changes:
services/keepstore/bufferpool_test.go | 5 +
services/keepstore/handlers.go | 26 +++-
services/keepstore/perms_test.go | 2 +-
services/keepstore/pull_worker.go | 1 +
services/keepstore/pull_worker_integration_test.go | 6 +-
services/keepstore/pull_worker_test.go | 48 +++----
services/keepstore/status_test.go | 21 +++
services/keepstore/trash_worker.go | 1 +
services/keepstore/trash_worker_test.go | 30 ++++-
services/keepstore/volume_test.go | 21 ++-
services/keepstore/work_queue.go | 148 ++++++++++++++-------
services/keepstore/work_queue_test.go | 147 ++++++++++++++++----
12 files changed, 339 insertions(+), 117 deletions(-)
create mode 100644 services/keepstore/status_test.go
via 5dd20e4a0aac7428a68dabbf5ec2c6800f32957b (commit)
via c52b7c3f28031e6dec9601ffd8583f689149a380 (commit)
via aae246886e945f0bba3bfa2a817971e4ad52e050 (commit)
via 318d446ad02c4511146403897db076acf16e0c9e (commit)
via d89b7ae1f6fa35dd3627ead14c855751f1de2193 (commit)
via 5562d6d556a942b66ea392c1e9bc803f9b9733e7 (commit)
via ab689cf0a5c73e1fa0525416fa12aaf5ba88abc9 (commit)
via 4de0af809ffbef43d89cd1751e5d611a4b5445e9 (commit)
from 522404b2066c8b635a240f79dd4bf652479afadb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 5dd20e4a0aac7428a68dabbf5ec2c6800f32957b
Merge: 522404b c52b7c3
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 11 13:51:09 2015 -0400
Merge branch '6260-work-queue-status' refs #6260
commit c52b7c3f28031e6dec9601ffd8583f689149a380
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 11 11:13:34 2015 -0400
6260: Add explanatory comment about testing /status.json.
diff --git a/services/keepstore/status_test.go b/services/keepstore/status_test.go
index 134b016..74de61e 100644
--- a/services/keepstore/status_test.go
+++ b/services/keepstore/status_test.go
@@ -4,6 +4,12 @@ import (
"encoding/json"
)
+// We don't have isolated unit tests for /status.json yet, but we do
+// check (e.g., in pull_worker_test.go) that /status.json reports
+// specific statistics correctly at the appropriate times.
+
+// getStatusItem("foo","bar","baz") retrieves /status.json, decodes
+// the response body into resp, and returns resp["foo"]["bar"]["baz"].
func getStatusItem(keys ...string) interface{} {
resp := IssueRequest(&RequestTester{"/status.json", "", "GET", nil})
var s interface{}
commit aae246886e945f0bba3bfa2a817971e4ad52e050
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 11 11:07:28 2015 -0400
6260: Rename ReportDone to DoneItem.
diff --git a/services/keepstore/pull_worker.go b/services/keepstore/pull_worker.go
index d55fd32..acf8611 100644
--- a/services/keepstore/pull_worker.go
+++ b/services/keepstore/pull_worker.go
@@ -24,7 +24,7 @@ func RunPullWorker(pullq *WorkQueue, keepClient *keepclient.KeepClient) {
for item := range nextItem {
pullRequest := item.(PullRequest)
err := PullItemAndProcess(item.(PullRequest), GenerateRandomApiToken(), keepClient)
- pullq.ReportDone <- struct{}{}
+ pullq.DoneItem <- struct{}{}
if err == nil {
log.Printf("Pull %s success", pullRequest)
} else {
diff --git a/services/keepstore/trash_worker.go b/services/keepstore/trash_worker.go
index 2cf2dc8..8f78658 100644
--- a/services/keepstore/trash_worker.go
+++ b/services/keepstore/trash_worker.go
@@ -18,7 +18,7 @@ func RunTrashWorker(trashq *WorkQueue) {
for item := range trashq.NextItem {
trashRequest := item.(TrashRequest)
TrashItem(trashRequest)
- trashq.ReportDone <- struct{}{}
+ trashq.DoneItem <- struct{}{}
}
}
diff --git a/services/keepstore/work_queue.go b/services/keepstore/work_queue.go
index 58e4966..f1878ff 100644
--- a/services/keepstore/work_queue.go
+++ b/services/keepstore/work_queue.go
@@ -89,11 +89,11 @@ type WorkQueue struct {
newlist chan *list.List
// Workers get work items by reading from this channel.
NextItem <-chan interface{}
- // Each worker must send struct{}{} to ReportDone exactly once
+ // Each worker must send struct{}{} to DoneItem exactly once
// for each work item received from NextItem, when it stops
// working on that item (regardless of whether the work was
// successful).
- ReportDone chan<- struct{}
+ DoneItem chan<- struct{}
}
type WorkQueueStatus struct {
@@ -108,10 +108,10 @@ func NewWorkQueue() *WorkQueue {
reportDone := make(chan struct{})
newList := make(chan *list.List)
b := WorkQueue{
- getStatus: make(chan WorkQueueStatus),
- newlist: newList,
- NextItem: nextItem,
- ReportDone: reportDone,
+ getStatus: make(chan WorkQueueStatus),
+ newlist: newList,
+ NextItem: nextItem,
+ DoneItem: reportDone,
}
go func() {
// Read new work lists from the newlist channel.
diff --git a/services/keepstore/work_queue_test.go b/services/keepstore/work_queue_test.go
index 7844a2b..74c67f2 100644
--- a/services/keepstore/work_queue_test.go
+++ b/services/keepstore/work_queue_test.go
@@ -59,7 +59,7 @@ func doWorkItems(t fatalfer, q *WorkQueue, expected []int) {
if !ok {
t.Fatalf("Expected %+v but channel was closed after receiving %+v as expected.", expected, expected[:i])
}
- q.ReportDone <- struct{}{}
+ q.DoneItem <- struct{}{}
if actual.(int) != expected[i] {
t.Fatalf("Expected %+v but received %+v after receiving %+v as expected.", expected[i], actual, expected[:i])
}
@@ -101,7 +101,7 @@ func TestWorkQueueDoneness(t *testing.T) {
for _ = range b.NextItem {
<-gate
time.Sleep(time.Millisecond)
- b.ReportDone <- struct{}{}
+ b.DoneItem <- struct{}{}
}
}()
expectEqualWithin(t, time.Second, 0, func() interface{} { return b.Status().InProgress })
@@ -167,7 +167,7 @@ func TestWorkQueueClose(t *testing.T) {
<-b.NextItem
mark <- struct{}{}
<-mark
- b.ReportDone <- struct{}{}
+ b.DoneItem <- struct{}{}
}()
b.ReplaceQueue(makeTestWorkList(input))
// Wait for worker to take item 1
commit 318d446ad02c4511146403897db076acf16e0c9e
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 11 11:07:13 2015 -0400
6260: Improve Gate explanation.
diff --git a/services/keepstore/volume_test.go b/services/keepstore/volume_test.go
index d660017..c5a7491 100644
--- a/services/keepstore/volume_test.go
+++ b/services/keepstore/volume_test.go
@@ -22,10 +22,13 @@ type MockVolume struct {
// Readonly volumes return an error for Put, Delete, and
// Touch.
Readonly bool
- // Every operation (except Status) starts by receiving from
- // Gate. Send one value to unblock one operation; close the
- // channel to unblock all. By default, it is a closed channel,
- // so all operations proceed without blocking.
+ // Gate is a "starting gate", allowing test cases to pause
+ // volume operations long enough to inspect state. Every
+ // operation (except Status) starts by receiving from
+ // Gate. Sending one value unblocks one operation; closing the
+ // channel unblocks all operations. By default, Gate is a
+ // closed channel, so all operations proceed without
+ // blocking. See trash_worker_test.go for an example.
Gate chan struct{}
called map[string]int
mutex sync.Mutex
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list