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
4264aac1
Commit
4264aac1
authored
Oct 14, 2015
by
Marek Grabowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15610 from piosz/enable-ir-e2e
Fixed Initial Resources e2e test to not depend on other tests
parents
4f6ac7ec
ebac6de5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
initial_resources.go
test/e2e/initial_resources.go
+10
-1
monitoring.go
test/e2e/monitoring.go
+20
-15
No files found.
test/e2e/initial_resources.go
View file @
4264aac1
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"fmt"
"fmt"
"time"
"time"
influxdb
"github.com/influxdb/influxdb/client"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
...
@@ -28,7 +29,15 @@ import (
...
@@ -28,7 +29,15 @@ import (
var
_
=
Describe
(
"Initial Resources"
,
func
()
{
var
_
=
Describe
(
"Initial Resources"
,
func
()
{
f
:=
NewFramework
(
"initial-resources"
)
f
:=
NewFramework
(
"initial-resources"
)
It
(
"[Skipped] should set initial resources based on historical data"
,
func
()
{
It
(
"[Skipped][Autoscaling Suite] should set initial resources based on historical data"
,
func
()
{
// Cleanup data in InfluxDB that left from previous tests.
influxdbClient
,
err
:=
getInfluxdbClient
(
f
.
Client
)
expectNoError
(
err
,
"failed to create influxdb client"
)
_
,
err
=
influxdbClient
.
Query
(
"drop series autoscaling.cpu.usage.2m"
,
influxdb
.
Second
)
expectNoError
(
err
)
_
,
err
=
influxdbClient
.
Query
(
"drop series autoscaling.memory.usage.2m"
,
influxdb
.
Second
)
expectNoError
(
err
)
cpu
:=
100
cpu
:=
100
mem
:=
200
mem
:=
200
for
i
:=
0
;
i
<
10
;
i
++
{
for
i
:=
0
;
i
<
10
;
i
++
{
...
...
test/e2e/monitoring.go
View file @
4264aac1
...
@@ -132,6 +132,24 @@ func getAllNodesInCluster(c *client.Client) ([]string, error) {
...
@@ -132,6 +132,24 @@ func getAllNodesInCluster(c *client.Client) ([]string, error) {
return
result
,
nil
return
result
,
nil
}
}
func
getInfluxdbClient
(
c
*
client
.
Client
)
(
*
influxdb
.
Client
,
error
)
{
kubeMasterHttpClient
,
ok
:=
c
.
Client
.
(
*
http
.
Client
)
if
!
ok
{
Failf
(
"failed to get master http client"
)
}
proxyUrl
:=
fmt
.
Sprintf
(
"%s/api/v1/proxy/namespaces/%s/services/%s:api/"
,
getMasterHost
(),
api
.
NamespaceSystem
,
influxdbService
)
config
:=
&
influxdb
.
ClientConfig
{
Host
:
proxyUrl
,
// TODO(vishh): Infer username and pw from the Pod spec.
Username
:
influxdbUser
,
Password
:
influxdbPW
,
Database
:
influxdbDatabaseName
,
HttpClient
:
kubeMasterHttpClient
,
IsSecure
:
true
,
}
return
influxdb
.
NewClient
(
config
)
}
func
getInfluxdbData
(
c
*
influxdb
.
Client
,
query
string
)
(
map
[
string
]
bool
,
error
)
{
func
getInfluxdbData
(
c
*
influxdb
.
Client
,
query
string
)
(
map
[
string
]
bool
,
error
)
{
series
,
err
:=
c
.
Query
(
query
,
influxdb
.
Second
)
series
,
err
:=
c
.
Query
(
query
,
influxdb
.
Second
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -204,21 +222,8 @@ func testMonitoringUsingHeapsterInfluxdb(c *client.Client) {
...
@@ -204,21 +222,8 @@ func testMonitoringUsingHeapsterInfluxdb(c *client.Client) {
expectNoError
(
err
)
expectNoError
(
err
)
expectNoError
(
expectedServicesExist
(
c
))
expectNoError
(
expectedServicesExist
(
c
))
// TODO: Wait for all pods and services to be running.
// TODO: Wait for all pods and services to be running.
kubeMasterHttpClient
,
ok
:=
c
.
Client
.
(
*
http
.
Client
)
if
!
ok
{
influxdbClient
,
err
:=
getInfluxdbClient
(
c
)
Failf
(
"failed to get master http client"
)
}
proxyUrl
:=
fmt
.
Sprintf
(
"%s/api/v1/proxy/namespaces/%s/services/%s:api/"
,
getMasterHost
(),
api
.
NamespaceSystem
,
influxdbService
)
config
:=
&
influxdb
.
ClientConfig
{
Host
:
proxyUrl
,
// TODO(vishh): Infer username and pw from the Pod spec.
Username
:
influxdbUser
,
Password
:
influxdbPW
,
Database
:
influxdbDatabaseName
,
HttpClient
:
kubeMasterHttpClient
,
IsSecure
:
true
,
}
influxdbClient
,
err
:=
influxdb
.
NewClient
(
config
)
expectNoError
(
err
,
"failed to create influxdb client"
)
expectNoError
(
err
,
"failed to create influxdb client"
)
expectedNodes
,
err
:=
getAllNodesInCluster
(
c
)
expectedNodes
,
err
:=
getAllNodesInCluster
(
c
)
...
...
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