summaryrefslogtreecommitdiff
path: root/docs/reference/node-startup-controller/test-target-startup-monitoring.xml
blob: d95210e52fbbed23de1bb36140626648db64cedf (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
]>

<refentry id="test-target-startup-monitoring">
  <refmeta>
    <refentrytitle>Tests for target startup monitoring</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>Tests for target startup monitoring</refname>
    <refpurpose>
      How to verify that the target startup monitoring functionality of the
      NSC correctly identifies targets have started, and sets the node state
      accordingly via the NSM.
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Test environment and setup</title>
    <refsect2>
      <title>Target units</title>
      <para>
        This testing requires the existence of focussed.target, unfocussed.target and
        lazy.target units.

        If they do not exist, they can be created by executing the following:
        <programlisting>cp /lib/systemd/system/{graphical,focussed}.target
cp /lib/systemd/system/{graphical,unfocussed}.target
cp /lib/systemd/system/{graphical,lazy}.target</programlisting>
      </para>
    </refsect2>
  </refsect1>

  <refsect1>
    <title>Test cases</title>
    <note>
      The node state is defined by the <link linkend="NSMNodeState">NSMNodeState</link>
      enumeration. When the node state is set, the DLT log refers to it by its number.
    </note>
    <para>
      The following test cases for Target Startup Monitoring are described in this document:
      <itemizedlist>
        <listitem><para><xref linkend="test-tsm-start-nsc" endterm="test-tsm-start-nsc-title"/></para></listitem>
        <listitem><para><xref linkend="test-tsm-start-focussed" endterm="test-tsm-start-focussed-title"/></para></listitem>
        <listitem><para><xref linkend="test-tsm-start-unfocussed" endterm="test-tsm-start-unfocussed-title"/></para></listitem>
        <listitem><para><xref linkend="test-tsm-start-lazy" endterm="test-tsm-start-lazy-title"/></para></listitem>
        <listitem><para><xref linkend="test-tsm-stop" endterm="test-tsm-stop-title"/></para></listitem>
      </itemizedlist>
    </para>
  </refsect1>
  <refsect1 id="test-tsm-start-nsc">
    <title id="test-tsm-start-nsc-title">1. Node state is set to BASE_RUNNING after Node Startup Controller is started</title>
    <refsect2>
      <title>Description</title>
      <para>
        Starts the NSM dummy and the Node Startup Controller and verifies that it attempts
        to set the node state.
      </para>
    </refsect2>
    <refsect2>
      <title>Test commands</title>
      <programlisting>systemctl start nsm-dummy.service
systemctl start node-startup-controller.service</programlisting>
    </refsect2>
    <refsect2>
      <title>Desired behaviour and output</title>
      <para>
        The DLT log should now contain the following log messages:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Applied the node state 2: yes]</entry></row>
        </tbody>
      </tgroup></informaltable>
    </refsect2>
  </refsect1>
  <refsect1 id="test-tsm-start-focussed">
    <title id="test-tsm-start-focussed-title">2. Node state is set to LUC_RUNNING after focussed.target is started</title>
    <refsect2>
      <title>Description</title>
      <para>
        Starts the focussed.target systemd unit and verifies that it attempts to set the
        node state.
      </para>
    </refsect2>
    <refsect2>
      <title>Test commands</title>
      <programlisting>systemctl start focussed.target
systemctl start focussed.target</programlisting>
    </refsect2>
    <note>
      <literal>systemctl start focussed.target</literal> is called twice because the NSM
      dummy rejects every other call to set the node state.
    </note>
    <refsect2>
      <title>Desired behaviour and output</title>
      <para>
        The DLT log should now contain the following log messages:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Node state 3 applied: yes]</entry></row>
        </tbody>
      </tgroup></informaltable>
    </refsect2>
  </refsect1>
  <refsect1 id="test-tsm-start-unfocussed">
    <title id="test-tsm-start-unfocussed-title">3. Node state is set to FULLY_RUNNING after unfocussed.target is started</title>
    <refsect2>
      <title>Description</title>
      <para>
        Starts the unfocussed.target systemd unit and verifies that it attempts to set the
        node state.
      </para>
    </refsect2>
    <refsect2>
      <title>Test commands</title>
      <programlisting>systemctl start unfocussed.target
systemctl start unfocussed.target</programlisting>
    </refsect2>
    <refsect2>
      <title>Desired Behaviour and output</title>
      <para>
        The DLT log should now contain the following log messages:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Node state 4 applied: yes]</entry></row>
        </tbody>
      </tgroup></informaltable>
    </refsect2>
  </refsect1>
  <refsect1 id="test-tsm-start-lazy">
    <title id="test-tsm-start-lazy-title">4. Node state is set to FULLY_OPERATIONAL after lazy.target is started</title>
    <refsect2>
      <title>Description</title>
      <para>
        Starts the lazy.target systemd unit and verifies that it attempts to set the
        node state.
      </para>
    </refsect2>
    <refsect2>
      <title>Test commands</title>
      <programlisting>systemctl start lazy.target
systemctl start lazy.target</programlisting>
    </refsect2>
    <refsect2>
      <title>Desired behaviour and output</title>
      <para>
        The DLT log should now contain the following log messages:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Node state 5 applied: yes]</entry></row>
        </tbody>
      </tgroup></informaltable>
    </refsect2>
  </refsect1>
  <refsect1 id="test-tsm-stop">
    <title id="test-tsm-stop-title">5. Stopping a target unit will not try to change the node state</title>
    <refsect2>
      <title>Description</title>
      <para>
        Stops a systemd unit and verifies that the Node Startup Controller doesn't try to
        set the node state.
      </para>
    </refsect2>
    <refsect2>
      <title>Test commands</title>
      <programlisting>systemctl stop focussed.target</programlisting>
    </refsect2>
    <refsect2>
      <title>Desired behaviour and output</title>
       <para>
        The DLT log should now contain the following log messages:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSC-</entry> <entry>CTRL</entry> <entry>[Creating D-Bus proxy for unit "/org/freedesktop/systemd1/unit/focussed_2etarget"]</entry></row>
          <row> <entry>NSC-</entry> <entry>CTRL</entry> <entry>[Active state of unit "focussed.target" changed to inactive]</entry></row>
        </tbody>
      </tgroup></informaltable>
      <para>
        The DLT log should <emphasis>not</emphasis> contain the following log message:
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Node state 3 applied: yes]</entry></row>
        </tbody>
      </tgroup></informaltable>
      <para>
        or
      </para>
      <informaltable><tgroup cols="3">
        <thead>
          <row> <entry>APID</entry> <entry>CTID</entry> <entry>Payload</entry> </row>
        </thead>
        <tbody>
          <row> <entry>NSMD</entry> <entry>NSMC</entry> <entry>[Node state 3 applied: no]</entry></row>
        </tbody>
      </tgroup></informaltable>
    </refsect2>
  </refsect1>

</refentry>