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
9ea1b3d8
Commit
9ea1b3d8
authored
Feb 26, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint failures for test/e2e/servicecatalog
parent
84aeafee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
34 deletions
+34
-34
.golint_failures
hack/.golint_failures
+0
-1
framework.go
test/e2e/servicecatalog/framework.go
+1
-0
podpreset.go
test/e2e/servicecatalog/podpreset.go
+33
-33
No files found.
hack/.golint_failures
View file @
9ea1b3d8
...
@@ -665,7 +665,6 @@ test/e2e/network
...
@@ -665,7 +665,6 @@ test/e2e/network
test/e2e/node
test/e2e/node
test/e2e/scalability
test/e2e/scalability
test/e2e/scheduling
test/e2e/scheduling
test/e2e/servicecatalog
test/e2e/storage
test/e2e/storage
test/e2e/storage/drivers
test/e2e/storage/drivers
test/e2e/storage/testsuites
test/e2e/storage/testsuites
...
...
test/e2e/servicecatalog/framework.go
View file @
9ea1b3d8
...
@@ -18,6 +18,7 @@ package servicecatalog
...
@@ -18,6 +18,7 @@ package servicecatalog
import
"github.com/onsi/ginkgo"
import
"github.com/onsi/ginkgo"
// SIGDescribe annotates the test with the SIG label.
func
SIGDescribe
(
text
string
,
body
func
())
bool
{
func
SIGDescribe
(
text
string
,
body
func
())
bool
{
return
ginkgo
.
Describe
(
"[sig-service-catalog] "
+
text
,
body
)
return
ginkgo
.
Describe
(
"[sig-service-catalog] "
+
text
,
body
)
}
}
test/e2e/servicecatalog/podpreset.go
View file @
9ea1b3d8
...
@@ -30,8 +30,8 @@ import (
...
@@ -30,8 +30,8 @@ import (
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
.
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"github.com/onsi/gomega"
imageutils
"k8s.io/kubernetes/test/utils/image"
imageutils
"k8s.io/kubernetes/test/utils/image"
)
)
...
@@ -39,7 +39,7 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -39,7 +39,7 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
f
:=
framework
.
NewDefaultFramework
(
"podpreset"
)
f
:=
framework
.
NewDefaultFramework
(
"podpreset"
)
var
podClient
*
framework
.
PodClient
var
podClient
*
framework
.
PodClient
BeforeEach
(
func
()
{
ginkgo
.
BeforeEach
(
func
()
{
// only run on gce for the time being til we find an easier way to update
// only run on gce for the time being til we find an easier way to update
// the admission controllers used on the others
// the admission controllers used on the others
framework
.
SkipUnlessProviderIs
(
"gce"
)
framework
.
SkipUnlessProviderIs
(
"gce"
)
...
@@ -47,8 +47,8 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -47,8 +47,8 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
})
})
// Simplest case: all pods succeed promptly
// Simplest case: all pods succeed promptly
It
(
"should create a pod preset"
,
func
()
{
ginkgo
.
It
(
"should create a pod preset"
,
func
()
{
By
(
"Creating a pod preset"
)
ginkgo
.
By
(
"Creating a pod preset"
)
pip
:=
&
settings
.
PodPreset
{
pip
:=
&
settings
.
PodPreset
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
...
@@ -77,9 +77,9 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -77,9 +77,9 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
if
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsNotFound
(
err
)
{
framework
.
Skipf
(
"podpresets requires k8s.io/api/settings/v1alpha1 to be enabled"
)
framework
.
Skipf
(
"podpresets requires k8s.io/api/settings/v1alpha1 to be enabled"
)
}
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
By
(
"creating the pod"
)
ginkgo
.
By
(
"creating the pod"
)
name
:=
"pod-preset-pod"
name
:=
"pod-preset-pod"
value
:=
strconv
.
Itoa
(
time
.
Now
()
.
Nanosecond
())
value
:=
strconv
.
Itoa
(
time
.
Now
()
.
Nanosecond
())
pod
:=
&
v1
.
Pod
{
pod
:=
&
v1
.
Pod
{
...
@@ -102,30 +102,30 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -102,30 +102,30 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
},
},
}
}
By
(
"setting up watch"
)
ginkgo
.
By
(
"setting up watch"
)
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
pods
,
err
:=
podClient
.
List
(
options
)
pods
,
err
:=
podClient
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to query for pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to query for pod"
)
Expect
(
len
(
pods
.
Items
))
.
To
(
Equal
(
0
))
gomega
.
Expect
(
len
(
pods
.
Items
))
.
To
(
gomega
.
Equal
(
0
))
options
=
metav1
.
ListOptions
{
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
(),
LabelSelector
:
selector
.
String
(),
ResourceVersion
:
pods
.
ListMeta
.
ResourceVersion
,
ResourceVersion
:
pods
.
ListMeta
.
ResourceVersion
,
}
}
w
,
err
:=
podClient
.
Watch
(
options
)
w
,
err
:=
podClient
.
Watch
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to set up watch"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to set up watch"
)
By
(
"submitting the pod to kubernetes"
)
ginkgo
.
By
(
"submitting the pod to kubernetes"
)
podClient
.
Create
(
pod
)
podClient
.
Create
(
pod
)
By
(
"verifying the pod is in kubernetes"
)
ginkgo
.
By
(
"verifying the pod is in kubernetes"
)
selector
=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
selector
=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
pods
,
err
=
podClient
.
List
(
options
)
pods
,
err
=
podClient
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to query for pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to query for pod"
)
Expect
(
len
(
pods
.
Items
))
.
To
(
Equal
(
1
))
gomega
.
Expect
(
len
(
pods
.
Items
))
.
To
(
gomega
.
Equal
(
1
))
By
(
"verifying pod creation was observed"
)
ginkgo
.
By
(
"verifying pod creation was observed"
)
select
{
select
{
case
event
,
_
:=
<-
w
.
ResultChan
()
:
case
event
,
_
:=
<-
w
.
ResultChan
()
:
if
event
.
Type
!=
watch
.
Added
{
if
event
.
Type
!=
watch
.
Added
{
...
@@ -139,10 +139,10 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -139,10 +139,10 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
// may be carried out immediately rather than gracefully.
// may be carried out immediately rather than gracefully.
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
pod
.
Name
))
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
pod
.
Name
))
By
(
"ensuring pod is modified"
)
ginkgo
.
By
(
"ensuring pod is modified"
)
// save the running pod
// save the running pod
pod
,
err
=
podClient
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
pod
,
err
=
podClient
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to GET scheduled pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to GET scheduled pod"
)
// check the annotation is there
// check the annotation is there
if
_
,
ok
:=
pod
.
Annotations
[
"podpreset.admission.kubernetes.io/podpreset-hello"
];
!
ok
{
if
_
,
ok
:=
pod
.
Annotations
[
"podpreset.admission.kubernetes.io/podpreset-hello"
];
!
ok
{
...
@@ -155,8 +155,8 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -155,8 +155,8 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
}
}
})
})
It
(
"should not modify the pod on conflict"
,
func
()
{
ginkgo
.
It
(
"should not modify the pod on conflict"
,
func
()
{
By
(
"Creating a pod preset"
)
ginkgo
.
By
(
"Creating a pod preset"
)
pip
:=
&
settings
.
PodPreset
{
pip
:=
&
settings
.
PodPreset
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
...
@@ -185,9 +185,9 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -185,9 +185,9 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
if
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsNotFound
(
err
)
{
framework
.
Skipf
(
"podpresets requires k8s.io/api/settings/v1alpha1 to be enabled"
)
framework
.
Skipf
(
"podpresets requires k8s.io/api/settings/v1alpha1 to be enabled"
)
}
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
By
(
"creating the pod"
)
ginkgo
.
By
(
"creating the pod"
)
name
:=
"pod-preset-pod"
name
:=
"pod-preset-pod"
value
:=
strconv
.
Itoa
(
time
.
Now
()
.
Nanosecond
())
value
:=
strconv
.
Itoa
(
time
.
Now
()
.
Nanosecond
())
originalPod
:=
&
v1
.
Pod
{
originalPod
:=
&
v1
.
Pod
{
...
@@ -211,30 +211,30 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -211,30 +211,30 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
},
},
}
}
By
(
"setting up watch"
)
ginkgo
.
By
(
"setting up watch"
)
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
pods
,
err
:=
podClient
.
List
(
options
)
pods
,
err
:=
podClient
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to query for pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to query for pod"
)
Expect
(
len
(
pods
.
Items
))
.
To
(
Equal
(
0
))
gomega
.
Expect
(
len
(
pods
.
Items
))
.
To
(
gomega
.
Equal
(
0
))
options
=
metav1
.
ListOptions
{
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
(),
LabelSelector
:
selector
.
String
(),
ResourceVersion
:
pods
.
ListMeta
.
ResourceVersion
,
ResourceVersion
:
pods
.
ListMeta
.
ResourceVersion
,
}
}
w
,
err
:=
podClient
.
Watch
(
options
)
w
,
err
:=
podClient
.
Watch
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to set up watch"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to set up watch"
)
By
(
"submitting the pod to kubernetes"
)
ginkgo
.
By
(
"submitting the pod to kubernetes"
)
podClient
.
Create
(
originalPod
)
podClient
.
Create
(
originalPod
)
By
(
"verifying the pod is in kubernetes"
)
ginkgo
.
By
(
"verifying the pod is in kubernetes"
)
selector
=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
selector
=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"time"
:
value
}))
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
options
=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
pods
,
err
=
podClient
.
List
(
options
)
pods
,
err
=
podClient
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to query for pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to query for pod"
)
Expect
(
len
(
pods
.
Items
))
.
To
(
Equal
(
1
))
gomega
.
Expect
(
len
(
pods
.
Items
))
.
To
(
gomega
.
Equal
(
1
))
By
(
"verifying pod creation was observed"
)
ginkgo
.
By
(
"verifying pod creation was observed"
)
select
{
select
{
case
event
,
_
:=
<-
w
.
ResultChan
()
:
case
event
,
_
:=
<-
w
.
ResultChan
()
:
if
event
.
Type
!=
watch
.
Added
{
if
event
.
Type
!=
watch
.
Added
{
...
@@ -248,10 +248,10 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
...
@@ -248,10 +248,10 @@ var _ = SIGDescribe("[Feature:PodPreset] PodPreset", func() {
// may be carried out immediately rather than gracefully.
// may be carried out immediately rather than gracefully.
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
originalPod
.
Name
))
framework
.
ExpectNoError
(
f
.
WaitForPodRunning
(
originalPod
.
Name
))
By
(
"ensuring pod is modified"
)
ginkgo
.
By
(
"ensuring pod is modified"
)
// save the running pod
// save the running pod
pod
,
err
:=
podClient
.
Get
(
originalPod
.
Name
,
metav1
.
GetOptions
{})
pod
,
err
:=
podClient
.
Get
(
originalPod
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed to GET scheduled pod"
)
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
(),
"failed to GET scheduled pod"
)
// check the annotation is not there
// check the annotation is not there
if
_
,
ok
:=
pod
.
Annotations
[
"podpreset.admission.kubernetes.io/podpreset-hello"
];
ok
{
if
_
,
ok
:=
pod
.
Annotations
[
"podpreset.admission.kubernetes.io/podpreset-hello"
];
ok
{
...
...
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