Merge pull request #1208 from runcom/moar-tests

contrib: test: integration: enable more e2e kube tests
This commit is contained in:
Daniel J Walsh 2017-12-18 10:25:50 -05:00 committed by GitHub
commit 6c0b79b706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 38 deletions

View file

@ -47,6 +47,8 @@
export API_HOST={{ ansible_default_ipv4.address }} export API_HOST={{ ansible_default_ipv4.address }}
export API_HOST_IP={{ ansible_default_ipv4.address }} export API_HOST_IP={{ ansible_default_ipv4.address }}
export KUBE_ENABLE_CLUSTER_DNS=true export KUBE_ENABLE_CLUSTER_DNS=true
export ENABLE_HOSTPATH_PROVISIONER=true
export KUBE_ENABLE_CLUSTER_DASHBOARD=true
./hack/local-up-cluster.sh ./hack/local-up-cluster.sh
mode: "u=rwx,g=rwx,o=x" mode: "u=rwx,g=rwx,o=x"

View file

@ -37,13 +37,14 @@
path: "{{ artifacts }}" path: "{{ artifacts }}"
state: directory state: directory
# TODO remove the last test skipped once https://github.com/kubernetes-incubator/cri-o/pull/1217 is merged
- name: Buffer the e2e testing command to workaround Ansible YAML folding "feature" - name: Buffer the e2e testing command to workaround Ansible YAML folding "feature"
set_fact: set_fact:
e2e_shell_cmd: > e2e_shell_cmd: >
/usr/bin/go run hack/e2e.go /usr/bin/go run hack/e2e.go
--test --test
--test_args="-host=https://{{ ansible_default_ipv4.address }}:6443 --test_args="-host=https://{{ ansible_default_ipv4.address }}:6443
--ginkgo.focus=\[Conformance\] --ginkgo.skip=\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|PersistentVolumes|\[HPA\]|should.support.building.a.client.with.a.CSR|should.support.inline.execution.and.attach
--report-dir={{ artifacts }}" --report-dir={{ artifacts }}"
&> {{ artifacts }}/e2e.log &> {{ artifacts }}/e2e.log
# Fix vim syntax hilighting: " # Fix vim syntax hilighting: "

View file

@ -96,8 +96,8 @@
vars: vars:
force_clone: True force_clone: True
# master as of 12/11/2017 # master as of 12/11/2017
k8s_git_version: "a48f11c2257d84b0bec89864025508b0ef626b4f" k8s_git_version: "master-nfs-fix"
k8s_github_fork: "kubernetes" k8s_github_fork: "runcom"
crio_socket: "/var/run/crio/crio.sock" crio_socket: "/var/run/crio/crio.sock"
- name: run k8s e2e tests - name: run k8s e2e tests
include: e2e.yml include: e2e.yml

View file

@ -624,8 +624,6 @@ type containerServerState struct {
// AddContainer adds a container to the container state store // AddContainer adds a container to the container state store
func (c *ContainerServer) AddContainer(ctr *oci.Container) { func (c *ContainerServer) AddContainer(ctr *oci.Container) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
sandbox := c.state.sandboxes.Get(ctr.Sandbox()) sandbox := c.state.sandboxes.Get(ctr.Sandbox())
sandbox.AddContainer(ctr) sandbox.AddContainer(ctr)
c.state.containers.Add(ctr.ID(), ctr) c.state.containers.Add(ctr.ID(), ctr)
@ -633,37 +631,26 @@ func (c *ContainerServer) AddContainer(ctr *oci.Container) {
// AddInfraContainer adds a container to the container state store // AddInfraContainer adds a container to the container state store
func (c *ContainerServer) AddInfraContainer(ctr *oci.Container) { func (c *ContainerServer) AddInfraContainer(ctr *oci.Container) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
c.state.infraContainers.Add(ctr.ID(), ctr) c.state.infraContainers.Add(ctr.ID(), ctr)
} }
// GetContainer returns a container by its ID // GetContainer returns a container by its ID
func (c *ContainerServer) GetContainer(id string) *oci.Container { func (c *ContainerServer) GetContainer(id string) *oci.Container {
c.stateLock.Lock()
defer c.stateLock.Unlock()
return c.state.containers.Get(id) return c.state.containers.Get(id)
} }
// GetInfraContainer returns a container by its ID // GetInfraContainer returns a container by its ID
func (c *ContainerServer) GetInfraContainer(id string) *oci.Container { func (c *ContainerServer) GetInfraContainer(id string) *oci.Container {
c.stateLock.Lock()
defer c.stateLock.Unlock()
return c.state.infraContainers.Get(id) return c.state.infraContainers.Get(id)
} }
// HasContainer checks if a container exists in the state // HasContainer checks if a container exists in the state
func (c *ContainerServer) HasContainer(id string) bool { func (c *ContainerServer) HasContainer(id string) bool {
c.stateLock.Lock() return c.state.containers.Get(id) != nil
defer c.stateLock.Unlock()
ctr := c.state.containers.Get(id)
return ctr != nil
} }
// RemoveContainer removes a container from the container state store // RemoveContainer removes a container from the container state store
func (c *ContainerServer) RemoveContainer(ctr *oci.Container) { func (c *ContainerServer) RemoveContainer(ctr *oci.Container) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
sbID := ctr.Sandbox() sbID := ctr.Sandbox()
sb := c.state.sandboxes.Get(sbID) sb := c.state.sandboxes.Get(sbID)
sb.RemoveContainer(ctr) sb.RemoveContainer(ctr)
@ -672,15 +659,11 @@ func (c *ContainerServer) RemoveContainer(ctr *oci.Container) {
// RemoveInfraContainer removes a container from the container state store // RemoveInfraContainer removes a container from the container state store
func (c *ContainerServer) RemoveInfraContainer(ctr *oci.Container) { func (c *ContainerServer) RemoveInfraContainer(ctr *oci.Container) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
c.state.infraContainers.Delete(ctr.ID()) c.state.infraContainers.Delete(ctr.ID())
} }
// listContainers returns a list of all containers stored by the server state // listContainers returns a list of all containers stored by the server state
func (c *ContainerServer) listContainers() []*oci.Container { func (c *ContainerServer) listContainers() []*oci.Container {
c.stateLock.Lock()
defer c.stateLock.Unlock()
return c.state.containers.List() return c.state.containers.List()
} }
@ -704,43 +687,36 @@ func (c *ContainerServer) ListContainers(filters ...func(*oci.Container) bool) (
// AddSandbox adds a sandbox to the sandbox state store // AddSandbox adds a sandbox to the sandbox state store
func (c *ContainerServer) AddSandbox(sb *sandbox.Sandbox) { func (c *ContainerServer) AddSandbox(sb *sandbox.Sandbox) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
c.state.sandboxes.Add(sb.ID(), sb) c.state.sandboxes.Add(sb.ID(), sb)
c.stateLock.Lock()
c.state.processLevels[selinux.NewContext(sb.ProcessLabel())["level"]]++ c.state.processLevels[selinux.NewContext(sb.ProcessLabel())["level"]]++
c.stateLock.Unlock()
} }
// GetSandbox returns a sandbox by its ID // GetSandbox returns a sandbox by its ID
func (c *ContainerServer) GetSandbox(id string) *sandbox.Sandbox { func (c *ContainerServer) GetSandbox(id string) *sandbox.Sandbox {
c.stateLock.Lock()
defer c.stateLock.Unlock()
return c.state.sandboxes.Get(id) return c.state.sandboxes.Get(id)
} }
// GetSandboxContainer returns a sandbox's infra container // GetSandboxContainer returns a sandbox's infra container
func (c *ContainerServer) GetSandboxContainer(id string) *oci.Container { func (c *ContainerServer) GetSandboxContainer(id string) *oci.Container {
c.stateLock.Lock()
defer c.stateLock.Unlock()
sb := c.state.sandboxes.Get(id) sb := c.state.sandboxes.Get(id)
return sb.InfraContainer() return sb.InfraContainer()
} }
// HasSandbox checks if a sandbox exists in the state // HasSandbox checks if a sandbox exists in the state
func (c *ContainerServer) HasSandbox(id string) bool { func (c *ContainerServer) HasSandbox(id string) bool {
c.stateLock.Lock() return c.state.sandboxes.Get(id) != nil
defer c.stateLock.Unlock()
sb := c.state.sandboxes.Get(id)
return sb != nil
} }
// RemoveSandbox removes a sandbox from the state store // RemoveSandbox removes a sandbox from the state store
func (c *ContainerServer) RemoveSandbox(id string) { func (c *ContainerServer) RemoveSandbox(id string) {
c.stateLock.Lock()
defer c.stateLock.Unlock()
sb := c.state.sandboxes.Get(id) sb := c.state.sandboxes.Get(id)
processLabel := sb.ProcessLabel() processLabel := sb.ProcessLabel()
c.state.sandboxes.Delete(id)
level := selinux.NewContext(processLabel)["level"] level := selinux.NewContext(processLabel)["level"]
c.stateLock.Lock()
pl, ok := c.state.processLevels[level] pl, ok := c.state.processLevels[level]
if ok { if ok {
c.state.processLevels[level] = pl - 1 c.state.processLevels[level] = pl - 1
@ -749,12 +725,13 @@ func (c *ContainerServer) RemoveSandbox(id string) {
delete(c.state.processLevels, level) delete(c.state.processLevels, level)
} }
} }
c.stateLock.Unlock()
c.state.sandboxes.Delete(id)
} }
// ListSandboxes lists all sandboxes in the state store // ListSandboxes lists all sandboxes in the state store
func (c *ContainerServer) ListSandboxes() []*sandbox.Sandbox { func (c *ContainerServer) ListSandboxes() []*sandbox.Sandbox {
c.stateLock.Lock()
defer c.stateLock.Unlock()
return c.state.sandboxes.List() return c.state.sandboxes.List()
} }

View file

@ -25,8 +25,9 @@ func (c *memoryStore) Add(id string, cont *Sandbox) {
// Get returns a sandbox from the store by id. // Get returns a sandbox from the store by id.
func (c *memoryStore) Get(id string) *Sandbox { func (c *memoryStore) Get(id string) *Sandbox {
var res *Sandbox
c.RLock() c.RLock()
res := c.s[id] res = c.s[id]
c.RUnlock() c.RUnlock()
return res return res
} }

View file

@ -25,8 +25,9 @@ func (c *memoryStore) Add(id string, cont *Container) {
// Get returns a container from the store by id. // Get returns a container from the store by id.
func (c *memoryStore) Get(id string) *Container { func (c *memoryStore) Get(id string) *Container {
var res *Container
c.RLock() c.RLock()
res := c.s[id] res = c.s[id]
c.RUnlock() c.RUnlock()
return res return res
} }