Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d75fd821
Commit
d75fd821
authored
Oct 16, 2017
by
Karol Wychowaniec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix expected result in Custom Metrics - Stackdriver Adapter e2e test
parent
1d4e1d2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
custom_metrics_stackdriver.go
.../instrumentation/monitoring/custom_metrics_stackdriver.go
+16
-8
No files found.
test/e2e/instrumentation/monitoring/custom_metrics_stackdriver.go
View file @
d75fd821
...
@@ -121,11 +121,22 @@ func testAdapter(f *framework.Framework, kubeClient clientset.Interface, customM
...
@@ -121,11 +121,22 @@ func testAdapter(f *framework.Framework, kubeClient clientset.Interface, customM
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"Failed to retrieve a list of supported metrics: %s"
,
err
)
framework
.
Failf
(
"Failed to retrieve a list of supported metrics: %s"
,
err
)
}
}
gotCustomMetric
,
gotUnusedMetric
:=
false
,
false
for
_
,
resource
:=
range
resources
.
APIResources
{
for
_
,
resource
:=
range
resources
.
APIResources
{
if
resource
.
Name
!=
"pods/"
+
CustomMetricName
&&
resource
.
Name
!=
"pods/"
+
UnusedMetricName
{
if
resource
.
Name
==
"pods/"
+
CustomMetricName
{
gotCustomMetric
=
true
}
else
if
resource
.
Name
==
"pods/"
+
UnusedMetricName
{
gotUnusedMetric
=
true
}
else
{
framework
.
Failf
(
"Unexpected metric %s. Only metric %s should be supported"
,
resource
.
Name
,
CustomMetricName
)
framework
.
Failf
(
"Unexpected metric %s. Only metric %s should be supported"
,
resource
.
Name
,
CustomMetricName
)
}
}
}
}
if
!
gotCustomMetric
{
framework
.
Failf
(
"Metric '%s' expected but not received"
,
CustomMetricName
)
}
if
!
gotUnusedMetric
{
framework
.
Failf
(
"Metric '%s' expected but not received"
,
UnusedMetricName
)
}
value
,
err
:=
customMetricsClient
.
NamespacedMetrics
(
f
.
Namespace
.
Name
)
.
GetForObject
(
schema
.
GroupKind
{
Group
:
""
,
Kind
:
"Pod"
},
stackdriverExporterPod1
,
CustomMetricName
)
value
,
err
:=
customMetricsClient
.
NamespacedMetrics
(
f
.
Namespace
.
Name
)
.
GetForObject
(
schema
.
GroupKind
{
Group
:
""
,
Kind
:
"Pod"
},
stackdriverExporterPod1
,
CustomMetricName
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"Failed query: %s"
,
err
)
framework
.
Failf
(
"Failed query: %s"
,
err
)
...
@@ -141,14 +152,11 @@ func testAdapter(f *framework.Framework, kubeClient clientset.Interface, customM
...
@@ -141,14 +152,11 @@ func testAdapter(f *framework.Framework, kubeClient clientset.Interface, customM
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"Failed query: %s"
,
err
)
framework
.
Failf
(
"Failed query: %s"
,
err
)
}
}
if
len
(
values
.
Items
)
!=
2
{
if
len
(
values
.
Items
)
!=
1
{
framework
.
Failf
(
"Expected results for exactly
2 pods
, but %v results received"
,
len
(
values
.
Items
))
framework
.
Failf
(
"Expected results for exactly
1 pod
, but %v results received"
,
len
(
values
.
Items
))
}
}
for
_
,
value
:=
range
values
.
Items
{
if
values
.
Items
[
0
]
.
DescribedObject
.
Name
!=
stackdriverExporterPod1
||
values
.
Items
[
0
]
.
Value
.
Value
()
!=
CustomMetricValue
{
if
(
value
.
DescribedObject
.
Name
==
stackdriverExporterPod1
&&
value
.
Value
.
Value
()
!=
CustomMetricValue
)
||
framework
.
Failf
(
"Unexpected metric value for metric %s and pod %s: %v"
,
CustomMetricName
,
values
.
Items
[
0
]
.
DescribedObject
.
Name
,
values
.
Items
[
0
]
.
Value
.
Value
())
(
value
.
DescribedObject
.
Name
==
stackdriverExporterPod2
&&
value
.
Value
.
Value
()
!=
UnusedMetricValue
)
{
framework
.
Failf
(
"Unexpected metric value for metric %s and pod %s: %v"
,
CustomMetricName
,
value
.
DescribedObject
.
Name
,
value
.
Value
.
Value
())
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment