aboutsummaryrefslogtreecommitdiffstats
path: root/spec/classes/tripleo_selinux_spec.rb
blob: f49f87bfa872c818cca21a35973ed6548cb944ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Unit tests for tripleo::selinux
#

require 'spec_helper'

describe 'tripleo::selinux' do

  shared_examples_for 'tripleo::selinux' do

    context 'with selinux enforcing' do
      before :each do
        facts.merge!({
          :selinux              => true,
          :selinux_current_mode => 'enforcing'
        })
      end

      let :params do
        { :mode       => 'disabled',
          :booleans   => ['foo', 'bar'],
          :modules    => ['module1', 'module2'],
          :directory  => '/path/to/modules'}
      end

      it 'runs setenforce 0' do
        is_expected.to contain_exec('/sbin/setenforce 0')
      end

      it 'enables the SELinux boolean' do
        is_expected.to contain_selboolean('foo').with(
          :persistent => true,
          :value      => 'on',
        )
      end

      it 'enables the SELinux modules' do
        is_expected.to contain_selmodule('module1').with(
          :ensure       => 'present',
          :selmoduledir => '/path/to/modules',
        )
      end

    end

    context 'with selinux disabled' do
      before :each do
        facts.merge!({ :selinux => 'false' })
      end

      let :params do
        { :mode       => 'enforcing',
          :booleans   => ['foo', 'bar'],
          :modules    => ['module1', 'module2'],
          :directory  => '/path/to/modules'}
      end

      it 'runs setenforce 1' do
        is_expected.to contain_exec('/sbin/setenforce 1')
      end

      it 'enables the SELinux boolean' do
        is_expected.to contain_selboolean('foo').with(
          :persistent => true,
          :value      => 'on',
        )
      end

      it 'enables the SELinux modules' do
        is_expected.to contain_selmodule('module1').with(
          :ensure       => 'present',
          :selmoduledir => '/path/to/modules',
        )
      end

    end

  end

  context 'on Debian platforms' do
    let :facts do
      { :osfamily => 'Debian' }
    end

    it_raises 'a Puppet::Error', /OS family unsuppored yet \(Debian\), SELinux support is only limited to RedHat family OS/
  end

  on_supported_os.each do |os, facts|
    context "on #{os}" do
      let(:facts) do
        facts.merge({})
      end

      it_behaves_like 'tripleo::selinux'
    end
  end
end
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873
{
  "__inputs": [
    {
      "name": "DS_YARDSTICK",
      "label": "yardstick",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.4.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": []
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "refresh": false,
  "rows": [
    {
      "collapse": false,
      "height": 702,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "yardstick",
          "fill": 0,
          "id": 1,
          "legend": {
            "alignAsTable": false,
            "avg": false,
            "current": false,
            "max": true,
            "min": true,
            "rightSide": true,
            "show": true,
            "sideWidth": 220,
            "total": false,
            "values": true
          },
          "lines": false,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": true,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "alias": "16MB",
              "yaxis": 1
            }
          ],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "512B",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies0.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "1KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "B",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies1.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "2KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "C",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies2.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "3KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "D",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies3.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "4KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "E",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies4.size"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "6KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "F",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies5.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "8KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "G",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies6.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "12KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "H",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies7.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "16KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "I",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies8.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "24KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "J",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies9.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "32KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "K",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies10.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "48KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "L",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies11.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "64KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "M",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies12.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "96KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "N",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies13.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "128KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "O",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies14.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "192KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "P",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies15.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "256KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "Q",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies16.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "384KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "R",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies17.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "512KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "S",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies18.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "768KB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "T",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies19.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "1MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "U",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies20.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "1.5MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "V",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies21.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "2MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "W",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies22.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "3MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "X",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies23.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "4MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "Y",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies24.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "6MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "refId": "Z",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies25.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "8MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies26.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "12MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies27.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "16MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies28.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "24MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies29.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "32MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies30.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "48MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies31.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            },
            {
              "alias": "64MB",
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "opnfv_yardstick_tc010",
              "orderByTime": "ASC",
              "policy": "default",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "latencies32.latency"
                    ],
                    "type": "field"
                  }
                ]
              ],
              "tags": []
            }
          ],
          "thresholds": [
            {
              "colorMode": "warning",
              "fill": true,
              "line": true,
              "op": "gt",
              "value": 30
            },
            {
              "colorMode": "ok",
              "fill": true,
              "line": true,
              "op": "lt",
              "value": 30
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Memory Read Latency - Lmbench",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "ns",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [
    "Compute"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now/d",
    "to": "now/d"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "opnfv_yardstick_tc010",
  "version": 12
}