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
55bc668f
Unverified
Commit
55bc668f
authored
Oct 11, 2018
by
Mikhail Mazurskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seed math/rand in TestMain before tests are executed
parent
f5e9c047
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+1
-1
main_test.go
test/integration/volume/main_test.go
+3
-0
persistent_volumes_test.go
test/integration/volume/persistent_volumes_test.go
+0
-1
No files found.
test/e2e_node/e2e_node_suite_test.go
View file @
55bc668f
...
@@ -74,6 +74,7 @@ func init() {
...
@@ -74,6 +74,7 @@ func init() {
}
}
func
TestMain
(
m
*
testing
.
M
)
{
func
TestMain
(
m
*
testing
.
M
)
{
rand
.
Seed
(
time
.
Now
()
.
UnixNano
())
pflag
.
Parse
()
pflag
.
Parse
()
framework
.
AfterReadingAllFlags
(
&
framework
.
TestContext
)
framework
.
AfterReadingAllFlags
(
&
framework
.
TestContext
)
os
.
Exit
(
m
.
Run
())
os
.
Exit
(
m
.
Run
())
...
@@ -119,7 +120,6 @@ func TestE2eNode(t *testing.T) {
...
@@ -119,7 +120,6 @@ func TestE2eNode(t *testing.T) {
return
return
}
}
// If run-services-mode is not specified, run test.
// If run-services-mode is not specified, run test.
rand
.
Seed
(
time
.
Now
()
.
UnixNano
())
RegisterFailHandler
(
Fail
)
RegisterFailHandler
(
Fail
)
reporters
:=
[]
Reporter
{}
reporters
:=
[]
Reporter
{}
reportDir
:=
framework
.
TestContext
.
ReportDir
reportDir
:=
framework
.
TestContext
.
ReportDir
...
...
test/integration/volume/main_test.go
View file @
55bc668f
...
@@ -17,11 +17,14 @@ limitations under the License.
...
@@ -17,11 +17,14 @@ limitations under the License.
package
volume
package
volume
import
(
import
(
"math/rand"
"testing"
"testing"
"time"
"k8s.io/kubernetes/test/integration/framework"
"k8s.io/kubernetes/test/integration/framework"
)
)
func
TestMain
(
m
*
testing
.
M
)
{
func
TestMain
(
m
*
testing
.
M
)
{
rand
.
Seed
(
time
.
Now
()
.
UnixNano
())
framework
.
EtcdMain
(
m
.
Run
)
framework
.
EtcdMain
(
m
.
Run
)
}
}
test/integration/volume/persistent_volumes_test.go
View file @
55bc668f
...
@@ -256,7 +256,6 @@ func TestPersistentVolumeBindRace(t *testing.T) {
...
@@ -256,7 +256,6 @@ func TestPersistentVolumeBindRace(t *testing.T) {
glog
.
V
(
2
)
.
Infof
(
"TestPersistentVolumeBindRace claims created"
)
glog
.
V
(
2
)
.
Infof
(
"TestPersistentVolumeBindRace claims created"
)
// putting a bind manually on a pv should only match the claim it is bound to
// putting a bind manually on a pv should only match the claim it is bound to
rand
.
Seed
(
time
.
Now
()
.
Unix
())
claim
:=
claims
[
rand
.
Intn
(
maxClaims
-
1
)]
claim
:=
claims
[
rand
.
Intn
(
maxClaims
-
1
)]
claimRef
,
err
:=
ref
.
GetReference
(
legacyscheme
.
Scheme
,
claim
)
claimRef
,
err
:=
ref
.
GetReference
(
legacyscheme
.
Scheme
,
claim
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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