예제 #1
0
파일: test_util.py 프로젝트: XDsubhash/mita
    def test_unicode_does_not_barf(self, monkeypatch):
        class FakeConn(object):
            def get_node_config(self, node_name):
                str(node_name)
                return '<slave></slave>'

        monkeypatch.setattr('mita.util.jenkins_connection', lambda: FakeConn())
        name = u'\u2018vagrant\u2019'
        result = util.get_node_labels(name)
        assert result == []
예제 #2
0
파일: test_util.py 프로젝트: XDsubhash/mita
    def test_get_correct_node_labels(self):
        xml_string = """<?xml version="1.0" encoding="UTF-8"?>
<slave>
  <name>centos7+158.69.77.220</name>
  <description></description>
  <remoteFS>/home/jenkins-build/build</remoteFS>
  <numExecutors>1</numExecutors>
  <mode>NORMAL</mode>
  <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
  <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]">
    <host>158.69.77.220</host>
    <port>22</port>
    <credentialsId>39fa150b-b2a1-416e-b334-29a9a2c0b32d</credentialsId>
    <maxNumRetries>0</maxNumRetries>
    <retryWaitTime>0</retryWaitTime>
  </launcher>
  <label>amd64 centos7 x86_64 huge</label>
  <nodeProperties/>
  <userId>prado</userId>
</slave>
        """
        result = util.get_node_labels('trusty', _xml_configuration=xml_string)
        assert result == ['amd64', 'centos7', 'x86_64', 'huge']
예제 #3
0
    def test_get_correct_node_labels(self):
        xml_string = """<?xml version="1.0" encoding="UTF-8"?>
<slave>
  <name>centos7+158.69.77.220</name>
  <description></description>
  <remoteFS>/home/jenkins-build/build</remoteFS>
  <numExecutors>1</numExecutors>
  <mode>NORMAL</mode>
  <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
  <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]">
    <host>158.69.77.220</host>
    <port>22</port>
    <credentialsId>39fa150b-b2a1-416e-b334-29a9a2c0b32d</credentialsId>
    <maxNumRetries>0</maxNumRetries>
    <retryWaitTime>0</retryWaitTime>
  </launcher>
  <label>amd64 centos7 x86_64 huge</label>
  <nodeProperties/>
  <userId>prado</userId>
</slave>
        """
        result = util.get_node_labels('trusty', _xml_configuration=xml_string)
        assert result == ['amd64', 'centos7', 'x86_64', 'huge']
예제 #4
0
파일: test_util.py 프로젝트: XDsubhash/mita
 def test_get_no_node_labels(self):
     result = util.get_node_labels('trusty',
                                   _xml_configuration='<slave></slave>')
     assert result == []
예제 #5
0
 def test_get_no_node_labels(self):
     result = util.get_node_labels('trusty', _xml_configuration='<slave></slave>')
     assert result == []