diff --git a/.travis.yml b/.travis.yml index 05eb193a..73871c1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,8 +70,8 @@ jobs: # the `platforms` defined in `kitchen.yml` - env: INSTANCE=default-debian-10-master-py3 - env: INSTANCE=default-ubuntu-1804-master-py3 - # env: INSTANCE=default-centos-8-master-py3 - # env: INSTANCE=default-fedora-31-master-py3 + - env: INSTANCE=redhat-centos-8-master-py3 + - env: INSTANCE=redhat-fedora-31-master-py3 - env: INSTANCE=default-opensuse-leap-151-master-py3 # - env: INSTANCE=default-amazonlinux-2-master-py3 # - env: INSTANCE=default-debian-10-3000-2-py3 diff --git a/kitchen.yml b/kitchen.yml index 4f578a20..caef73e5 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -266,7 +266,7 @@ suites: verifier: inspec_tests: - path: test/integration/default - - name: pkgrepo + - name: redhat provisioner: state_top: base: @@ -279,7 +279,7 @@ suites: '*': - kubernetes pillars_from_files: - kubernetes.sls: test/salt/pillar/pkgrepo.sls + kubernetes.sls: test/salt/pillar/redhat.sls verifier: inspec_tests: - - path: test/integration/pkgrepo + - path: test/integration/redhat diff --git a/test/integration/default/controls/default_spec.rb b/test/integration/default/controls/default_spec.rb index 2503a847..06a7e003 100644 --- a/test/integration/default/controls/default_spec.rb +++ b/test/integration/default/controls/default_spec.rb @@ -75,11 +75,11 @@ it { should be_file } it { should_not be_directory } end - # describe file('/usr/local/kubernetes-k3s-v1.18.4+k3s1/bin') do - # it { should exist } - # it { should be_directory } - # its('type') { should eq :directory } - # end + describe file('/usr/local/kubernetes-k3s-v1.18.4+k3s1/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end describe file('/tmp/kubernetes-tmp/k3s-bootstrap.sh') do it { should exist } its('mode') { should cmp '0755' } diff --git a/test/integration/pkgrepo/controls/default_spec.rb b/test/integration/pkgrepo/controls/default_spec.rb deleted file mode 100644 index d35a7641..00000000 --- a/test/integration/pkgrepo/controls/default_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -title 'kubernetes package repo profile' - -control 'kubernetes package repo' do - impact 1.0 - title 'should be installed' - - describe file('/etc/default/kubectl.sh') do - it { should exist } - end - describe file('/etc/default/minikube.sh') do - it { should exist } - end - # describe file('/usr/local/bin/kubectl') do - # it { should exist } - # end - # describe file('/usr/local/bin/minikube') do - # it { should exist } - # end -end diff --git a/test/integration/pkgrepo/README.md b/test/integration/redhat/README.md similarity index 75% rename from test/integration/pkgrepo/README.md rename to test/integration/redhat/README.md index 37cf963c..535b0d88 100644 --- a/test/integration/pkgrepo/README.md +++ b/test/integration/redhat/README.md @@ -1,16 +1,16 @@ -# InSpec Profile: `default` +# InSpec Profile: `redhat` -This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). +This shows the implementation of the `redhat` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). ## Verify a profile InSpec ships with built-in features to verify a profile structure. ```bash -$ inspec check default +$ inspec check redhat Summary ------- -Location: default +Location: redhat Profile: profile Controls: 4 Timestamp: 2019-06-24T23:09:01+00:00 @@ -28,7 +28,7 @@ Warnings To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. ```bash -$ inspec exec default +$ inspec exec redhat .. Finished in 0.0025 seconds (files took 0.12449 seconds to load) @@ -40,7 +40,7 @@ Finished in 0.0025 seconds (files took 0.12449 seconds to load) To run one control from the profile use `inspec exec /path/to/profile --controls name`. ```bash -$ inspec exec default --controls package +$ inspec exec redhat --controls package . Finished in 0.0025 seconds (files took 0.12449 seconds to load) diff --git a/test/integration/redhat/controls/default_spec.rb b/test/integration/redhat/controls/default_spec.rb new file mode 100644 index 00000000..1376e0ae --- /dev/null +++ b/test/integration/redhat/controls/default_spec.rb @@ -0,0 +1,185 @@ +# frozen_string_literal: true + +title 'kubernetes redhat profile' + +control 'kubernetes archive' do + impact 1.0 + title 'should be installed' + + describe file('/usr/local/kubernetes-server-v1.18.0/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-server-v1.18.0/bin/kubectl') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/kubernetes-node-v1.18.0/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-kind-v0.8.1/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-kind-v0.8.1/bin/kind') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/kubernetes-node-v1.18.0/bin/kubectl') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/kubernetes-client-v1.18.0/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-client-v1.18.0/bin/kubectl') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/bin/kubectl') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/kubernetes-minikube-v1.9.2/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-minikube-v1.9.2/bin/minikube') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/bin/minikube') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/kubernetes-devspace-v4.13.1/bin') do + it { should exist } + it { should be_directory } + its('type') { should eq :directory } + end + describe file('/usr/local/kubernetes-devspace-v4.13.1/bin/devspace') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/bin/devspace') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + # describe file('/usr/local/kubernetes-k3s-v1.18.4+k3s1/bin') do + # it { should exist } + # it { should be_directory } + # its('type') { should eq :directory } + # end + describe file('/tmp/kubernetes-tmp/k3s-bootstrap.sh') do + it { should exist } + its('mode') { should cmp '0755' } + end + describe file('/usr/local/bin/k3s') do + it { should be_file } + it { should_not be_directory } + end + # describe file('/usr/bin/crictl') do + # describe file('/usr/local/bin/crictl') do + # it { should be_file } + # it { should_not be_directory } + # end + describe file('/usr/local/bin/ctr') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/k3s-killall.sh') do + it { should be_file } + end + describe file('/usr/local/bin/k3s-uninstall.sh') do + it { should be_file } + end + describe file('/usr/local/bin/kubectl-kudo') do + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/etcd') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/kube-apiserver') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/kubebuilder') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/kind') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/kubernetes-linkerd2-v20.7.1/bin/linkerd') do + it { should_not be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/linkerd') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/kubernetes-istio-v1.6.4/bin/istioctl') do + it { should_not be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/istioctl') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/kubernetes-octant-v0.13.1/octant') do + it { should_not be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/bin/octant') do + it { should be_symlink } + it { should be_file } + it { should_not be_directory } + end + describe file('/usr/local/src/kubernetes/python') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/java') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/javascript') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/csharp') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/grafana-operator') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/prometheus-operator') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/akka-cluster-operator') do + it { should be_directory } + end + describe file('/usr/local/src/kubernetes/istio-operator') do + it { should be_directory } + end +end diff --git a/test/integration/pkgrepo/inspec.yml b/test/integration/redhat/inspec.yml similarity index 96% rename from test/integration/pkgrepo/inspec.yml rename to test/integration/redhat/inspec.yml index e76d498a..8db9e3ed 100644 --- a/test/integration/pkgrepo/inspec.yml +++ b/test/integration/redhat/inspec.yml @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- -name: default +name: redhat title: kubernetes formula maintainer: SaltStack Formulas license: Apache-2.0 diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls index fda9b672..14e6c588 100644 --- a/test/salt/pillar/default.sls +++ b/test/salt/pillar/default.sls @@ -2,6 +2,21 @@ # vim: ft=yaml --- kubernetes: + supported: + - server + - client + - node + - devspace + - istio + - linkerd2 + - kubebuilder + - octant + - k3s + - kind + - kudo + - minikube + - operators + kubectl: environ: a: b diff --git a/test/salt/pillar/pkgrepo.sls b/test/salt/pillar/redhat.sls similarity index 50% rename from test/salt/pillar/pkgrepo.sls rename to test/salt/pillar/redhat.sls index a81d2f4c..34d54b68 100644 --- a/test/salt/pillar/pkgrepo.sls +++ b/test/salt/pillar/redhat.sls @@ -2,14 +2,28 @@ # vim: ft=yaml --- kubernetes: + supported: + - server + - client + - node + - devspace + - istio + - linkerd2 + - kubebuilder + - octant + - kind + - kudo + - minikube + - operators + kubectl: environ: a: b linux: altpriority: 1000 pkg: - use_upstream_repo: true - use_upstream_binary: false + use_upstream_repo: false + use_upstream_binary: true minikube: environ: a: b