[ARVADOS] updated: 1.3.0-455-gf4b7e7bf5

Git user git at public.curoverse.com
Tue Mar 12 14:20:18 EDT 2019


Summary of changes:
 services/keepstore/azure_blob_volume_test.go | 14 ++++++++------
 services/keepstore/s3_volume_test.go         |  7 ++-----
 services/keepstore/stats_ticker.go           |  1 -
 services/keepstore/unix_volume_test.go       |  7 ++-----
 services/keepstore/volume_generic_test.go    | 22 ++++++++++++----------
 services/keepstore/volume_test.go            |  8 +++-----
 6 files changed, 27 insertions(+), 32 deletions(-)

       via  f4b7e7bf5b1a875db95a42781937c2a690062dd3 (commit)
       via  7828fd69ba467eaa99713fc02e54b029b3a9f45e (commit)
      from  8660244c570cecdb5b4c25a3809cfe01fafebada (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 f4b7e7bf5b1a875db95a42781937c2a690062dd3
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Mar 12 15:19:36 2019 -0300

    13937: Removes the 'any' operation type for a better way of testing driver labels
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go
index 522544ebf..cfad7577c 100644
--- a/services/keepstore/azure_blob_volume_test.go
+++ b/services/keepstore/azure_blob_volume_test.go
@@ -746,6 +746,10 @@ func (v *TestableAzureBlobVolume) Teardown() {
 	v.azStub.Close()
 }
 
+func (v *TestableAzureBlobVolume) ReadWriteOperationLabelValues() (r, w string) {
+	return "get", "create"
+}
+
 func (v *TestableAzureBlobVolume) DeviceID() string {
 	// Dummy device id for testing purposes
 	return "azure://azure_blob_volume_test"
diff --git a/services/keepstore/s3_volume_test.go b/services/keepstore/s3_volume_test.go
index 6fd6b653e..6377420ff 100644
--- a/services/keepstore/s3_volume_test.go
+++ b/services/keepstore/s3_volume_test.go
@@ -493,3 +493,7 @@ func (v *TestableS3Volume) TouchWithDate(locator string, lastPut time.Time) {
 func (v *TestableS3Volume) Teardown() {
 	v.server.Quit()
 }
+
+func (v *TestableS3Volume) ReadWriteOperationLabelValues() (r, w string) {
+	return "get", "put"
+}
diff --git a/services/keepstore/stats_ticker.go b/services/keepstore/stats_ticker.go
index 29daeb6dd..342b9e320 100644
--- a/services/keepstore/stats_ticker.go
+++ b/services/keepstore/stats_ticker.go
@@ -74,7 +74,6 @@ func (s *statsTicker) TickOps(operations ...string) {
 		return
 	}
 	for _, opType := range operations {
-		s.opsCounters.With(prometheus.Labels{"operation": "any"}).Inc()
 		s.opsCounters.With(prometheus.Labels{"operation": opType}).Inc()
 	}
 }
diff --git a/services/keepstore/unix_volume_test.go b/services/keepstore/unix_volume_test.go
index 8b2bc2d54..872f408cf 100644
--- a/services/keepstore/unix_volume_test.go
+++ b/services/keepstore/unix_volume_test.go
@@ -74,6 +74,10 @@ func (v *TestableUnixVolume) Teardown() {
 	}
 }
 
+func (v *TestableUnixVolume) ReadWriteOperationLabelValues() (r, w string) {
+	return "open", "create"
+}
+
 // serialize = false; readonly = false
 func TestUnixVolumeWithGenericTests(t *testing.T) {
 	DoGenericVolumeTests(t, func(t TB) TestableVolume {
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index c118c20d6..d5a413693 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -573,20 +573,23 @@ func testMetrics(t TB, factory TestableVolumeFactory) {
 		return
 	}
 
-	var c, anyOpCounter float64
-	anyOpCounter = getValueFrom(opsC, prometheus.Labels{"operation": "any"})
+	var c, writeOpCounter, readOpCounter float64
+
+	readOpType, writeOpType := v.ReadWriteOperationLabelValues()
+	writeOpCounter = getValueFrom(opsC, prometheus.Labels{"operation": writeOpType})
+	readOpCounter = getValueFrom(opsC, prometheus.Labels{"operation": readOpType})
+
 	// Test Put if volume is writable
 	if v.Writable() {
 		err = v.Put(context.Background(), TestHash, TestBlock)
 		if err != nil {
 			t.Errorf("Got err putting block %q: %q, expected nil", TestBlock, err)
 		}
-		// Check that the operations counter increased
-		c = getValueFrom(opsC, prometheus.Labels{"operation": "any"})
-		if c <= anyOpCounter {
+		// Check that the write operations counter increased
+		c = getValueFrom(opsC, prometheus.Labels{"operation": writeOpType})
+		if c <= writeOpCounter {
 			t.Error("Operation(s) not counted on Put")
 		}
-		anyOpCounter = c
 		// Check that bytes counter is > 0
 		if getValueFrom(ioC, prometheus.Labels{"direction": "out"}) == 0 {
 			t.Error("ioBytes{direction=out} counter shouldn't be zero")
@@ -602,11 +605,10 @@ func testMetrics(t TB, factory TestableVolumeFactory) {
 	}
 
 	// Check that the operations counter increased
-	c = getValueFrom(opsC, prometheus.Labels{"operation": "any"})
-	if c <= anyOpCounter {
+	c = getValueFrom(opsC, prometheus.Labels{"operation": readOpType})
+	if c <= readOpCounter {
 		t.Error("Operation(s) not counted on Get")
 	}
-	anyOpCounter = c
 	// Check that the bytes "in" counter is > 0
 	if getValueFrom(ioC, prometheus.Labels{"direction": "in"}) == 0 {
 		t.Error("ioBytes{direction=in} counter shouldn't be zero")
diff --git a/services/keepstore/volume_test.go b/services/keepstore/volume_test.go
index 0451ee1e9..0b8af330f 100644
--- a/services/keepstore/volume_test.go
+++ b/services/keepstore/volume_test.go
@@ -27,6 +27,9 @@ type TestableVolume interface {
 	// bypassing all constraints like readonly and serialize.
 	PutRaw(locator string, data []byte)
 
+	// Returns the strings that a driver uses to record read/write operations.
+	ReadWriteOperationLabelValues() (r, w string)
+
 	// Specify the value Mtime() should return, until the next
 	// call to Touch, TouchWithDate, or Put.
 	TouchWithDate(locator string, lastPut time.Time)

commit 7828fd69ba467eaa99713fc02e54b029b3a9f45e
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Tue Mar 12 11:10:51 2019 -0300

    13937: Removes unnecessary data passing on tests.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go
index 8a5ffde26..522544ebf 100644
--- a/services/keepstore/azure_blob_volume_test.go
+++ b/services/keepstore/azure_blob_volume_test.go
@@ -746,16 +746,14 @@ func (v *TestableAzureBlobVolume) Teardown() {
 	v.azStub.Close()
 }
 
-func (v *TestableAzureBlobVolume) GetMetricsVecs() (opsCounters, errCounters, ioBytes *prometheus.CounterVec) {
-	opsCounters = v.container.stats.opsCounters
-	errCounters = v.container.stats.errCounters
-	ioBytes = v.container.stats.ioBytes
-	return
+func (v *TestableAzureBlobVolume) DeviceID() string {
+	// Dummy device id for testing purposes
+	return "azure://azure_blob_volume_test"
 }
 
 func (v *TestableAzureBlobVolume) Start(vm *volumeMetricsVecs) error {
 	// Override original Start() to be able to assign CounterVecs with a dummy DeviceID
-	v.container.stats.opsCounters, v.container.stats.errCounters, v.container.stats.ioBytes = vm.getCounterVecsFor(prometheus.Labels{"device_id": "azure_blob_volume_test"})
+	v.container.stats.opsCounters, v.container.stats.errCounters, v.container.stats.ioBytes = vm.getCounterVecsFor(prometheus.Labels{"device_id": v.DeviceID()})
 	return nil
 }
 
diff --git a/services/keepstore/s3_volume_test.go b/services/keepstore/s3_volume_test.go
index 3d7a630e0..6fd6b653e 100644
--- a/services/keepstore/s3_volume_test.go
+++ b/services/keepstore/s3_volume_test.go
@@ -493,10 +493,3 @@ func (v *TestableS3Volume) TouchWithDate(locator string, lastPut time.Time) {
 func (v *TestableS3Volume) Teardown() {
 	v.server.Quit()
 }
-
-func (v *TestableS3Volume) GetMetricsVecs() (opsCounters, errCounters, ioBytes *prometheus.CounterVec) {
-	opsCounters = v.bucket.stats.opsCounters
-	errCounters = v.bucket.stats.errCounters
-	ioBytes = v.bucket.stats.ioBytes
-	return
-}
diff --git a/services/keepstore/unix_volume_test.go b/services/keepstore/unix_volume_test.go
index 6582642ff..8b2bc2d54 100644
--- a/services/keepstore/unix_volume_test.go
+++ b/services/keepstore/unix_volume_test.go
@@ -74,13 +74,6 @@ func (v *TestableUnixVolume) Teardown() {
 	}
 }
 
-func (v *TestableUnixVolume) GetMetricsVecs() (opsCounters, errCounters, ioBytes *prometheus.CounterVec) {
-	opsCounters = v.os.stats.opsCounters
-	errCounters = v.os.stats.errCounters
-	ioBytes = v.os.stats.ioBytes
-	return
-}
-
 // serialize = false; readonly = false
 func TestUnixVolumeWithGenericTests(t *testing.T) {
 	DoGenericVolumeTests(t, func(t TB) TestableVolume {
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 964e68bb9..c118c20d6 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -556,7 +556,7 @@ func testMetrics(t TB, factory TestableVolumeFactory) {
 	if err != nil {
 		t.Error("Failed Start(): ", err)
 	}
-	opsC, _, ioC := v.GetMetricsVecs()
+	opsC, _, ioC := vm.getCounterVecsFor(prometheus.Labels{"device_id": v.DeviceID()})
 
 	if ioC == nil {
 		t.Error("ioBytes CounterVec is nil")
diff --git a/services/keepstore/volume_test.go b/services/keepstore/volume_test.go
index 5feae3c29..0451ee1e9 100644
--- a/services/keepstore/volume_test.go
+++ b/services/keepstore/volume_test.go
@@ -15,8 +15,6 @@ import (
 	"strings"
 	"sync"
 	"time"
-
-	"github.com/prometheus/client_golang/prometheus"
 )
 
 // A TestableVolume allows test suites to manipulate the state of an
@@ -25,9 +23,6 @@ import (
 type TestableVolume interface {
 	Volume
 
-	// Get prometheus metrics
-	GetMetricsVecs() (opsCounters, errCounters, ioBytes *prometheus.CounterVec)
-
 	// [Over]write content for a locator with the given data,
 	// bypassing all constraints like readonly and serialize.
 	PutRaw(locator string, data []byte)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list