Skip to content

Commit

Permalink
ci(redhat): standalone centos/fedora tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jul 9, 2020
1 parent ecd83ac commit ac0d984
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ suites:
verifier:
inspec_tests:
- path: test/integration/default
- name: pkgrepo
- name: redhat
provisioner:
state_top:
base:
Expand All @@ -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
10 changes: 5 additions & 5 deletions test/integration/default/controls/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
21 changes: 0 additions & 21 deletions test/integration/pkgrepo/controls/default_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
185 changes: 185 additions & 0 deletions test/integration/redhat/controls/default_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: default
name: redhat
title: kubernetes formula
maintainer: SaltStack Formulas
license: Apache-2.0
Expand Down
15 changes: 15 additions & 0 deletions test/salt/pillar/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions test/salt/pillar/pkgrepo.sls → test/salt/pillar/redhat.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac0d984

Please sign in to comment.