def test_check_insights_version_success(self):
     """Testing success response with new client versions."""
     new_versions = ['3.0.0-4', '3.0.2-2', '3.0.1-5', '3.0.3-1']
     for version in new_versions:
         streamdata = 'Client: %s\nCore: 3.0.8-1' % version
         result = check_insights_version(streamdata, '3.0.0-4', '3.0.8')
         self.assertNotIn('client', result.keys())
Beispiel #2
0
 def _check_insights_version(self):
     version_command = self.insights_command.version()
     process = subprocess.Popen(version_command,
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE)
     streamdata = format_subprocess_stderr(process)
     code = process.returncode
     version_check = check_insights_version(streamdata,
                                            insights.CLIENT_VERSION,
                                            insights.CORE_VERSION)
     if not version_check['results'] or code != 0:
         if 'client' in version_check.keys():
             print(_(messages.BAD_CLIENT_VERSION %
                     (version_check['client'],
                      insights.CLIENT_VERSION)))
         if 'core' in version_check.keys():
             print(_(messages.BAD_CORE_VERSION %
                     (version_check['core'],
                      insights.CORE_VERSION)))
         if 'error' in version_check.keys():
             print(_(messages.ERROR_INSIGHTS_VERSION %
                     (version_check['error'])))
         print(_(messages.CHECK_VERSION %
                 (' '.join(version_command))))
         sys.exit(1)
 def test_check_insights_version_failed(self):
     """Testing failed response with out of date client versions."""
     old_versions = ['3.0.0-4', '3.0.2-2', '3.0.1-5']
     for version in old_versions:
         streamdata = 'Client: %s\nCore: 3.0.8-1' % version
         result = check_insights_version(streamdata, '3.0.3-1', '3.0.8')
         self.assertIn('client', result.keys())