From 40132d786d437b6e379ae2aa10dce9d71244c07b Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Fri, 29 Sep 2017 11:49:12 -0700 Subject: [PATCH] Install Go directly from upstream, not through RPM Signed-off-by: Steve Kuznetsov --- contrib/test/integration/README.md | 21 ++++++ contrib/test/integration/build/bats.yml | 1 - contrib/test/integration/build/cri-tools.yml | 2 +- contrib/test/integration/e2e.yml | 2 +- contrib/test/integration/golang.yml | 28 +++++--- contrib/test/integration/system.yml | 68 +++++++++++++++----- contrib/test/integration/test.yml | 40 ++---------- contrib/test/integration/vars.yml | 58 ----------------- 8 files changed, 100 insertions(+), 120 deletions(-) create mode 100644 contrib/test/integration/README.md diff --git a/contrib/test/integration/README.md b/contrib/test/integration/README.md new file mode 100644 index 00000000..f13b8b92 --- /dev/null +++ b/contrib/test/integration/README.md @@ -0,0 +1,21 @@ +# Fedora and RHEL Integration and End-to-End Tests + +This directory contains playbooks to set up for and run the integration and +end-to-end tests for CRI-O on RHEL and Fedora hosts. Two entrypoints exist: + + - `main.yml`: sets up the machine and runs tests + - `results.yml`: gathers test output to `/tmp/artifacts` + +When running `main.yml`, three tags are present: + + - `setup`: run all tasks to set up the system for testing + - `e2e`: build CRI-O from source and run Kubernetes node E2Es + - `integration`: build CRI-O from source and run the local integration suite + +The playbooks assume the following things about your system: + + - on RHEL, the server and extras repos are configured and certs are present + - `ansible` is installed and the host is boot-strapped to allow `ansible` to run against it + - the `$GOPATH` is set and present for all shells (*e.g.* written in `/etc/environment`) + - CRI-O is checked out to the correct state at `${GOPATH}/src/github.com/kubernetes-incubator/cri-o` + - the user running the playbook has access to passwordless `sudo` \ No newline at end of file diff --git a/contrib/test/integration/build/bats.yml b/contrib/test/integration/build/bats.yml index e321c3bf..d4ea19c6 100644 --- a/contrib/test/integration/build/bats.yml +++ b/contrib/test/integration/build/bats.yml @@ -4,7 +4,6 @@ git: repo: "https://github.com/sstephenson/bats.git" dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats" - version: "{{ 'pull/161/head' if xunit else 'HEAD' }}" - name: install bats command: "./install.sh /usr/local" diff --git a/contrib/test/integration/build/cri-tools.yml b/contrib/test/integration/build/cri-tools.yml index 2bdb9e46..e314225e 100644 --- a/contrib/test/integration/build/cri-tools.yml +++ b/contrib/test/integration/build/cri-tools.yml @@ -7,7 +7,7 @@ version: "16e6fe4d7199c5689db4630a9330e6a8a12cecd1" - name: install crictl - command: "go install github.com/kubernetes-incubator/cri-tools/cmd/crictl" + command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/crictl" - name: link crictl file: diff --git a/contrib/test/integration/e2e.yml b/contrib/test/integration/e2e.yml index 878fd3ce..de43e2ed 100644 --- a/contrib/test/integration/e2e.yml +++ b/contrib/test/integration/e2e.yml @@ -40,7 +40,7 @@ - name: Buffer the e2e testing command to workaround Ansible YAML folding "feature" set_fact: e2e_shell_cmd: > - go run hack/e2e.go + /usr/bin/go run hack/e2e.go --test -test_args="-host=https://{{ ansible_default_ipv4.address }}:6443 --ginkgo.focus=\[Conformance\] diff --git a/contrib/test/integration/golang.yml b/contrib/test/integration/golang.yml index 0653d1d4..06a5db5a 100644 --- a/contrib/test/integration/golang.yml +++ b/contrib/test/integration/golang.yml @@ -1,22 +1,30 @@ --- -- name: set up GOPATH if it is not already set - lineinfile: - dest: /etc/environment - line: 'GOPATH={{ ansible_env.HOME }}/go' - regexp: 'GOPATH=' - state: present - when: ansible_env.GOPATH is not defined +- name: fetch Golang + unarchive: + remote_src: yes + src: https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz + dest: /usr/local + +- name: link go toolchain + file: + src: "/usr/local/go/bin/{{ item }}" + dest: "/usr/bin/{{ item }}" + state: link + with_items: + - go + - gofmt + - godoc - name: ensure user profile exists file: path: "{{ ansible_user_dir }}/.profile" state: touch -- name: set up PATH for Go binaries +- name: set up PATH for Go toolchain and built binaries lineinfile: dest: "{{ ansible_user_dir }}/.profile" - line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin' + line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin:/usr/local/go/bin' regexp: '^PATH=' state: present @@ -39,3 +47,5 @@ - onsi/gomega - cloudflare/cfssl/cmd/... - jteeuwen/go-bindata/go-bindata + - vbatts/git-validation + - cpuguy83/go-md2man diff --git a/contrib/test/integration/system.yml b/contrib/test/integration/system.yml index 5141e433..6adc4f2a 100644 --- a/contrib/test/integration/system.yml +++ b/contrib/test/integration/system.yml @@ -1,21 +1,59 @@ --- -- name: register a repo for Golang - yum_repository: - name: 'centos-paas-sig-openshift-origin37-rpms' - state: present - description: 'CentOS PaaS SIG Origin 3.7 Repository' - baseurl: 'https://cbs.centos.org/repos/paas7-openshift-origin37-candidate/x86_64/os/' - includepkgs: 'golang' - gpgcheck: no - sslverify: no - when: ansible_distribution in ['RedHat', 'CentOS'] - - name: Make sure we have all required packages package: name: "{{ item }}" state: present - with_items: "{{ rpm_pkgs }}" + with_items: + - container-selinux + - curl + - device-mapper-devel + - expect + - findutils + - gcc + - git + - glib2-devel + - glibc-devel + - glibc-static + - gpgme-devel + - hostname + - iproute + - iptables + - krb5-workstation + - libassuan-devel + - libffi-devel + - libgpg-error-devel + - libguestfs-tools + - libseccomp-devel + - libvirt-client + - libvirt-python + - libxml2-devel + - libxslt-devel + - make + - mlocate + - nfs-utils + - nmap-ncat + - oci-register-machine + - oci-systemd-hook + - oci-umount + - openssl + - openssl-devel + - ostree-devel + - pkgconfig + - python + - python2-boto + - python2-crypto + - python-devel + - python-virtualenv + - PyYAML + - redhat-rpm-config + - rpcbind + - rsync + - sed + - skopeo-containers + - socat + - tar + - wget async: 600 poll: 10 @@ -57,11 +95,6 @@ value: 1 when: ansible_distribution == 'CentOS' -- name: disable selinux see https://github.com/kubernetes-incubator/cri-o/issues/528 - selinux: - policy: targeted - state: permissive - - name: inject hostname into /etc/hosts lineinfile: dest: /etc/hosts @@ -75,3 +108,4 @@ - name: Update the kernel cmdline to include quota support command: grubby --update-kernel=ALL --args="rootflags=pquota" + when: ansible_distribution in ['RedHat', 'CentOS'] \ No newline at end of file diff --git a/contrib/test/integration/test.yml b/contrib/test/integration/test.yml index 5c58b4c6..45c394ed 100644 --- a/contrib/test/integration/test.yml +++ b/contrib/test/integration/test.yml @@ -1,13 +1,5 @@ --- -- name: Change test_runner.sh to use bats xunit output - lineinfile: - dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/test_runner.sh" - line: 'execute time bats --tap --junit $TESTS' - regexp: 'execute time bats --tap \$TESTS' - state: present - when: xunit - - name: Make testing output verbose so it can be converted to xunit lineinfile: dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh" @@ -20,32 +12,14 @@ extra_storage_opts: " --storage-opt overlay.override_kernel_check=1" when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS' -- name: set extra shell for non-xunit tests - set_fact: - extra_shell_suffix: " &> {{ artifacts }}/testout.txt" - when: not xunit - -- name: run integration tests - shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration{{ extra_shell_suffix }}" - args: - chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o" - ignore_errors: yes - register: integration_test - async: 5400 - poll: 30 - -- name: Make testing output directory +- name: ensure directory exists for e2e reports file: path: "{{ artifacts }}" state: directory - ignore_errors: yes - when: xunit -- name: Move all xunit files into one dir to scp - shell: "mv {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/TestReport-bats*.xml {{ artifacts }}" - when: xunit - -- name: ensure we fail on bad tests - fail: - msg: Integration tests failed! - when: "'not ok' in integration_test.stdout" +- name: run integration tests + shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration >& {{ artifacts }}/testout.txt" + args: + chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o" + async: 5400 + poll: 30 diff --git a/contrib/test/integration/vars.yml b/contrib/test/integration/vars.yml index 571e6bd6..f1e5e2f7 100644 --- a/contrib/test/integration/vars.yml +++ b/contrib/test/integration/vars.yml @@ -1,63 +1,5 @@ --- -# Enable using BATS to output integration-test xunit output (FIXME: broken? Kill it?) -xunit: false - -rpm_pkgs: - - container-selinux - - curl - - device-mapper-devel - - expect - - findutils - - gcc - - git - - glib2-devel - - glibc-devel - - glibc-static - - golang - - gpgme-devel - - hostname - - iproute - - iptables - - krb5-workstation - - libassuan-devel - - libffi-devel - - libgpg-error-devel - - libguestfs-tools - - libseccomp-devel - - libvirt-client - - libvirt-python - - libxml2-devel - - libxslt-devel - - make - - mlocate - - nfs-utils - - nmap-ncat - - npm - - oci-register-machine - - oci-systemd-hook - - oci-umount - - openssl - - openssl-devel - - ostree-devel - - pkgconfig - - python - - python2-boto - - python2-crypto - - python2-mock - - python-click - - python-devel - - python-virtualenv - - PyYAML - - redhat-rpm-config - - rpcbind - - rsync - - sed - - skopeo-containers - - socat - - tar - - wget - # For results.yml Paths use rsync 'source' conventions artifacts: "/tmp/artifacts" # Base-directory for collection crio_integration_filepath: "{{ artifacts }}/testout.txt"