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
f3de21bd
Unverified
Commit
f3de21bd
authored
Jun 08, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move integration tests into individual pacakges
Signed-off-by:
Mike Danese
<
mikedanese@google.com
>
parent
2da247ff
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
71 additions
and
42 deletions
+71
-42
test-integration.sh
hack/test-integration.sh
+10
-1
auth_test.go
test/integration/auth/auth_test.go
+0
-0
rbac_test.go
test/integration/auth/rbac_test.go
+1
-1
client_test.go
test/integration/client/client_test.go
+1
-1
dynamic_client_test.go
test/integration/client/dynamic_client_test.go
+1
-1
configmap_test.go
test/integration/configmap/configmap_test.go
+3
-2
garbage_collector_test.go
test/integration/garbagecollector/garbage_collector_test.go
+1
-1
kubectl_test.go
test/integration/kubectl/kubectl_test.go
+1
-1
etcd_tools_test.go
test/integration/master/etcd_tools_test.go
+1
-1
master_benchmark_test.go
test/integration/master/master_benchmark_test.go
+1
-1
master_test.go
test/integration/master/master_test.go
+13
-12
metrics_test.go
test/integration/metrics/metrics_test.go
+1
-1
openshift_test.go
test/integration/openshift/openshift_test.go
+1
-1
persistent_volumes_test.go
.../integration/persistentvolumes/persistent_volumes_test.go
+5
-4
pods_test.go
test/integration/pods/pods_test.go
+4
-3
quota_test.go
test/integration/quota/quota_test.go
+3
-2
extender_test.go
test/integration/scheduler/extender_test.go
+1
-1
scheduler_test.go
test/integration/scheduler/scheduler_test.go
+1
-1
secrets_test.go
test/integration/secrets/secrets_test.go
+4
-3
service_account_test.go
test/integration/serviceaccount/service_account_test.go
+3
-2
utils.go
test/integration/utils.go
+15
-2
No files found.
hack/test-integration.sh
View file @
f3de21bd
...
...
@@ -41,6 +41,15 @@ KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"
LOG_LEVEL
=
${
LOG_LEVEL
:-
2
}
KUBE_TEST_ARGS
=
${
KUBE_TEST_ARGS
:-}
kube::test::find_integration_test_dirs
()
{
(
cd
${
KUBE_ROOT
}
find
test
/integration
-name
'*_test.go'
-print0
\
| xargs
-0n1
dirname
\
|
sort
-u
)
}
cleanup
()
{
kube::log::status
"Cleaning up etcd"
kube::etcd::cleanup
...
...
@@ -58,7 +67,7 @@ runTests() {
KUBE_RACE
=
""
\
KUBE_TIMEOUT
=
"
${
KUBE_TIMEOUT
}
"
\
KUBE_TEST_API_VERSIONS
=
"
$1
"
\
"
${
KUBE_ROOT
}
/hack/test-go.sh"
test
/integration
"
${
KUBE_ROOT
}
/hack/test-go.sh"
$(
kube::test::find_integration_test_dirs
)
# Run the watch cache tests
# KUBE_TEST_ARGS doesn't mean anything to the watch cache test.
...
...
test/integration/auth_test.go
→
test/integration/auth
/auth
_test.go
View file @
f3de21bd
This diff is collapsed.
Click to expand it.
test/integration/rbac_test.go
→
test/integration/
auth/
rbac_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
auth
import
(
"bytes"
...
...
test/integration/client_test.go
→
test/integration/client
/client
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
client
import
(
"fmt"
...
...
test/integration/dynamic_client_test.go
→
test/integration/
client/
dynamic_client_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
client
import
(
"reflect"
...
...
test/integration/configmap_test.go
→
test/integration/configmap
/configmap
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
configmap
// This file tests use of the configMap API resource.
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/client/restclient"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -114,7 +115,7 @@ func DoTestConfigMap(t *testing.T, client *client.Client, ns *api.Namespace) {
if
_
,
err
:=
client
.
Pods
(
ns
.
Name
)
.
Create
(
pod
);
err
!=
nil
{
t
.
Errorf
(
"Failed to create pod: %v"
,
err
)
}
defer
d
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
defer
integration
.
D
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
}
func
deleteConfigMapOrErrorf
(
t
*
testing
.
T
,
c
*
client
.
Client
,
ns
,
name
string
)
{
...
...
test/integration/garbage_collector_test.go
→
test/integration/garbage
collector/garbage
_collector_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
garbagecollector
import
(
"fmt"
...
...
test/integration/kubectl_test.go
→
test/integration/kubectl
/kubectl
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
kubectl
import
(
"testing"
...
...
test/integration/etcd_tools_test.go
→
test/integration/
master/
etcd_tools_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
master
import
(
"strconv"
...
...
test/integration/master_benchmark_test.go
→
test/integration/master
/master
_benchmark_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
master
import
(
"flag"
...
...
test/integration/master_test.go
→
test/integration/master
/master
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
master
import
(
"bytes"
...
...
@@ -36,6 +36,7 @@ import (
"k8s.io/kubernetes/pkg/client/restclient"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -127,9 +128,9 @@ func TestAutoscalingGroupBackwardCompatibility(t *testing.T) {
expectedStatusCodes
map
[
int
]
bool
expectedVersion
string
}{
{
"POST"
,
autoscalingPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
hpaV1
,
c
ode201
,
""
},
{
"GET"
,
autoscalingPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
""
,
c
ode200
,
testapi
.
Autoscaling
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
""
,
c
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
{
"POST"
,
autoscalingPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
hpaV1
,
integration
.
C
ode201
,
""
},
{
"GET"
,
autoscalingPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
""
,
integration
.
C
ode200
,
testapi
.
Autoscaling
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"horizontalpodautoscalers"
,
api
.
NamespaceDefault
,
""
),
""
,
integration
.
C
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
}
for
_
,
r
:=
range
requests
{
...
...
@@ -271,15 +272,15 @@ func TestBatchGroupBackwardCompatibility(t *testing.T) {
expectedVersion
string
}{
// Post a v1 and get back both as v1beta1 and as v1.
{
"POST"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
""
),
jobV1
,
c
ode201
,
""
},
{
"GET"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Batch
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
{
"DELETE"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Default
.
GroupVersion
()
.
String
()},
// status response
{
"POST"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
""
),
jobV1
,
integration
.
C
ode201
,
""
},
{
"GET"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Batch
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
{
"DELETE"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Default
.
GroupVersion
()
.
String
()},
// status response
// Post a v1beta1 and get back both as v1beta1 and as v1.
{
"POST"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
""
),
jobV1beta1
,
c
ode201
,
""
},
{
"GET"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Batch
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
{
"DELETE"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
c
ode200
,
testapi
.
Default
.
GroupVersion
()
.
String
()},
//status response
{
"POST"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
""
),
jobV1beta1
,
integration
.
C
ode201
,
""
},
{
"GET"
,
batchPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Batch
.
GroupVersion
()
.
String
()},
{
"GET"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Extensions
.
GroupVersion
()
.
String
()},
{
"DELETE"
,
extensionsPath
(
"jobs"
,
api
.
NamespaceDefault
,
"pi"
),
""
,
integration
.
C
ode200
,
testapi
.
Default
.
GroupVersion
()
.
String
()},
//status response
}
for
_
,
r
:=
range
requests
{
...
...
test/integration/metrics_test.go
→
test/integration/metrics
/metrics
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
metrics
import
(
"bufio"
...
...
test/integration/openshift_test.go
→
test/integration/openshift
/openshift
_test.go
View file @
f3de21bd
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
openshift
import
(
"testing"
...
...
test/integration/persistent_volumes_test.go
→
test/integration/persistent
volumes/persistent
_volumes_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
persistentvolumes
import
(
"fmt"
...
...
@@ -27,8 +27,6 @@ import (
"testing"
"time"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
...
...
@@ -41,11 +39,14 @@ import (
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
"github.com/golang/glog"
)
func
init
()
{
r
equireEtcd
()
integration
.
R
equireEtcd
()
}
// Several tests in this file are configurable by environment variables:
...
...
test/integration/pods_test.go
→
test/integration/pods
/pods
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
pods
import
(
"fmt"
...
...
@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/client/restclient"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -142,7 +143,7 @@ func TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
t
.
Errorf
(
"%v: unexpected allowed update to pod"
,
tc
.
name
)
}
d
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
integration
.
D
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
}
}
...
...
@@ -177,5 +178,5 @@ func TestPodReadOnlyFilesystem(t *testing.T) {
t
.
Errorf
(
"Failed to create pod: %v"
,
err
)
}
d
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
integration
.
D
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
}
test/integration/quota_test.go
→
test/integration/quota
/quota
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
quota
import
(
"fmt"
...
...
@@ -40,11 +40,12 @@ import (
quotainstall
"k8s.io/kubernetes/pkg/quota/install"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/plugin/pkg/admission/resourcequota"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
func
init
()
{
r
equireEtcd
()
integration
.
R
equireEtcd
()
}
// 1.2 code gets:
...
...
test/integration/extender_test.go
→
test/integration/
scheduler/
extender_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
scheduler
// This file tests scheduler extender.
...
...
test/integration/scheduler_test.go
→
test/integration/scheduler
/scheduler
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
scheduler
// This file tests the scheduler.
...
...
test/integration/secret_test.go
→
test/integration/secret
s/secrets
_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
secrets
// This file tests use of the secrets API resource.
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/client/restclient"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -105,14 +106,14 @@ func DoTestSecrets(t *testing.T, client *client.Client, ns *api.Namespace) {
if
_
,
err
:=
client
.
Pods
(
ns
.
Name
)
.
Create
(
pod
);
err
!=
nil
{
t
.
Errorf
(
"Failed to create pod: %v"
,
err
)
}
defer
d
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
defer
integration
.
D
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
// Create a pod that consumes non-existent secret.
pod
.
ObjectMeta
.
Name
=
"uses-non-existent-secret"
if
_
,
err
:=
client
.
Pods
(
ns
.
Name
)
.
Create
(
pod
);
err
!=
nil
{
t
.
Errorf
(
"Failed to create pod: %v"
,
err
)
}
defer
d
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
defer
integration
.
D
eletePodOrErrorf
(
t
,
client
,
ns
.
Name
,
pod
.
Name
)
// This pod may fail to run, but we don't currently prevent this, and this
// test can't check whether the kubelet actually pulls the secret.
...
...
test/integration/service_account_test.go
→
test/integration/service
account/service
_account_test.go
View file @
f3de21bd
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
integration
package
serviceaccount
// This file tests authentication and (soon) authorization of HTTP requests to a master object.
// It does not use the client in pkg/client/... because authentication and authorization needs
...
...
@@ -47,6 +47,7 @@ import (
"k8s.io/kubernetes/pkg/util/wait"
serviceaccountadmission
"k8s.io/kubernetes/plugin/pkg/admission/serviceaccount"
"k8s.io/kubernetes/plugin/pkg/auth/authenticator/request/union"
"k8s.io/kubernetes/test/integration"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -59,7 +60,7 @@ const (
)
func
init
()
{
r
equireEtcd
()
integration
.
R
equireEtcd
()
}
func
TestServiceAccountAutoCreate
(
t
*
testing
.
T
)
{
...
...
test/integration/utils.go
View file @
f3de21bd
...
...
@@ -39,7 +39,7 @@ func newEtcdClient() etcd.Client {
return
client
}
func
r
equireEtcd
()
{
func
R
equireEtcd
()
{
if
_
,
err
:=
etcd
.
NewKeysAPI
(
newEtcdClient
())
.
Get
(
context
.
TODO
(),
"/"
,
nil
);
err
!=
nil
{
glog
.
Fatalf
(
"unable to connect to etcd for integration testing: %v"
,
err
)
}
...
...
@@ -51,8 +51,21 @@ func withEtcdKey(f func(string)) {
f
(
prefix
)
}
func
d
eletePodOrErrorf
(
t
*
testing
.
T
,
c
*
client
.
Client
,
ns
,
name
string
)
{
func
D
eletePodOrErrorf
(
t
*
testing
.
T
,
c
*
client
.
Client
,
ns
,
name
string
)
{
if
err
:=
c
.
Pods
(
ns
)
.
Delete
(
name
,
nil
);
err
!=
nil
{
t
.
Errorf
(
"unable to delete pod %v: %v"
,
name
,
err
)
}
}
// Requests to try. Each one should be forbidden or not forbidden
// depending on the authentication and authorization setup of the master.
var
Code200
=
map
[
int
]
bool
{
200
:
true
}
var
Code201
=
map
[
int
]
bool
{
201
:
true
}
var
Code400
=
map
[
int
]
bool
{
400
:
true
}
var
Code403
=
map
[
int
]
bool
{
403
:
true
}
var
Code404
=
map
[
int
]
bool
{
404
:
true
}
var
Code405
=
map
[
int
]
bool
{
405
:
true
}
var
Code409
=
map
[
int
]
bool
{
409
:
true
}
var
Code422
=
map
[
int
]
bool
{
422
:
true
}
var
Code500
=
map
[
int
]
bool
{
500
:
true
}
var
Code503
=
map
[
int
]
bool
{
503
:
true
}
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