~vila/byoci/trunk

« back to all changes in this revision

Viewing changes to byoci/tests/host/test_monitor.py

  • Committer: Vincent Ladeuil
  • Date: 2022-05-05 07:22:10 UTC
  • Revision ID: v.ladeuil+lp@free.fr-20220505072210-7i29gv17qdongjal
Preserve `host.ip` for tests so routing can happen on the host.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        # Inject jobs first
117
117
        test_cmd = 'cd /byoci && jenkins-jobs update jobs/'
118
118
        ret, out, err = subprocesses.run(
119
 
            ['byov', 'shell', self.monitor_name, test_cmd])
 
119
            ['byov', 'shell', self.monitor_name, test_cmd],
 
120
            raise_on_error=False)
120
121
        assertions.assertShellSuccess(self, test_cmd, ret, out, err)
121
122
 
122
123
    def test_succeeds(self):
123
124
        self.inject_jobs()
124
125
        # Now run a known one
125
126
        test_cmd = ('cd /byoci &&'
126
 
                    ' ./byo-ci-monitor run-job byoci/info-brz-slave-selftest')
 
127
                    ' ./byo-ci-monitor run-job byoci/info-' + self.slave_name)
127
128
        ret, out, err = subprocesses.run(
128
129
            ['byov', 'shell', self.monitor_name, test_cmd])
129
130
        assertions.assertShellSuccess(self, test_cmd, ret, out, err)
138
139
            subprocesses.run(['byov', 'shell', self.monitor_name, test_cmd])
139
140
        # because we tunnel through ssh, we get more \n...
140
141
        self.assertTrue(
141
 
            cm.exception.err.endswith('No job matches I-dont-exist\n\n\n'))
 
142
            cm.exception.err.endswith('No job matches I-dont-exist\n\n\n'),
 
143
            cm.exception.err)
142
144
 
143
145
    def test_matches(self):
144
146
        self.inject_jobs()
145
147
        test_cmd = (
146
148
            'cd /byoci &&'
147
 
            ' ./byo-ci-monitor run-job -n byoci/info-brz-slave-selftest')
 
149
            ' ./byo-ci-monitor run-job -n byoci/info-' + self.slave_name)
148
150
        ret, out, err = subprocesses.run(
149
151
            ['byov', 'shell', self.monitor_name, test_cmd])
150
152
        assertions.assertShellSuccess(self, test_cmd, ret, out, err)