You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/03/07 06:22:45 UTC

[skywalking-cli] branch test created (now a814b7e)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch test
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git.


      at a814b7e  Add test and update submodule

This branch includes the following new commits:

     new a814b7e  Add test and update submodule

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-cli] 01/01: Add test and update submodule

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git

commit a814b7e39f8127f73360f5485be4ca94251947ca
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Sat Mar 7 14:22:13 2020 +0800

    Add test and update submodule
---
 graphql/utils/adapter_test.go | 77 +++++++++++++++++++++++++++++++++++++++++++
 query-protocol                |  2 +-
 2 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/graphql/utils/adapter_test.go b/graphql/utils/adapter_test.go
new file mode 100644
index 0000000..ff3b64c
--- /dev/null
+++ b/graphql/utils/adapter_test.go
@@ -0,0 +1,77 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package utils
+
+import (
+	"reflect"
+	"testing"
+
+	"github.com/apache/skywalking-cli/graphql/schema"
+)
+
+func TestMetricsToMap(t *testing.T) {
+	type args struct {
+		duration  schema.Duration
+		intValues schema.IntValues
+	}
+	tests := []struct {
+		name string
+		args args
+		want map[string]float64
+	}{
+		{
+			name: "Should convert to map",
+			args: args{
+				duration: schema.Duration{
+					Start: "2020-01-01 0000",
+					End:   "2020-01-01 0007",
+					Step:  schema.StepMinute,
+				},
+				intValues: schema.IntValues{
+					Values: []*schema.KVInt{
+						{Value: 0},
+						{Value: 1},
+						{Value: 2},
+						{Value: 3},
+						{Value: 4},
+						{Value: 5},
+						{Value: 6},
+						{Value: 7},
+					},
+				},
+			},
+			want: map[string]float64{
+				"2020-01-01 0000": 0,
+				"2020-01-01 0001": 1,
+				"2020-01-01 0002": 2,
+				"2020-01-01 0003": 3,
+				"2020-01-01 0004": 4,
+				"2020-01-01 0005": 5,
+				"2020-01-01 0006": 6,
+				"2020-01-01 0007": 7,
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := MetricsToMap(tt.args.duration, tt.args.intValues); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("MetricsToMap() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
diff --git a/query-protocol b/query-protocol
index 8c9a8c4..06373bf 160000
--- a/query-protocol
+++ b/query-protocol
@@ -1 +1 @@
-Subproject commit 8c9a8c45b9dbe954efa6de50202d05b1ef8e6be2
+Subproject commit 06373bf0d1204b6d3f410c0daf4c7f72529f28a0