Ejemplo n.º 1
0
    def test_jshint1(self):

        set_verbose(True)
        jshint.genv.ROLE = 'local'
        jshint.genv.services = ['jshint']
        jshint.clear_caches()

#         packager.update()
#         packager.upgrade(full=1)

        print('Installing jshint...')
        jshint.env.enabled = True
        jshint.clear_local_renderer()
        #jshint.install_packages() # fails on Ubuntu 14 under Travis-CI?
        #jshint.sudo('apt-get purge nodejs-legacy nodejs')
        #jshint.sudo('apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get -f -o Dpkg::Options::="--force-overwrite" install --yes npm')
        jshint.configure()
        deploy_satchel.purge()
        print('-'*80)
        print('Thumbprinting...')
        deploy_satchel.fake(components=jshint.name)
        print('-'*80)

        # Confirm jshint was installed.
        #assert exists('/usr/local/bin/jshint')
        output = jshint.run('jshint --version')
        print('output:', output)
        assert 'jshint v' in output

        print('Disabling jshint...')
        jshint.env.enabled = False
        jshint.clear_local_renderer()
        jshint.configure()
Ejemplo n.º 2
0
    def test_jshint1(self):

        set_verbose(True)
        jshint.genv.ROLE = 'local'
        jshint.genv.services = ['jshint']
        jshint.clear_caches()

        #         packager.update()
        #         packager.upgrade(full=1)

        print('Installing jshint...')
        jshint.env.enabled = True
        jshint.clear_local_renderer()
        #jshint.install_packages() # fails on Ubuntu 14 under Travis-CI?
        #jshint.sudo('apt-get purge nodejs-legacy nodejs')
        #jshint.sudo('apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get -f -o Dpkg::Options::="--force-overwrite" install --yes npm')
        jshint.configure()
        deploy_satchel.purge()
        print('-' * 80)
        print('Thumbprinting...')
        deploy_satchel.fake(components=jshint.name)
        print('-' * 80)

        # Confirm jshint was installed.
        #assert exists('/usr/local/bin/jshint')
        output = jshint.run('jshint --version')
        print('output:', output)
        assert 'jshint v' in output

        print('Disabling jshint...')
        jshint.env.enabled = False
        jshint.clear_local_renderer()
        jshint.configure()
Ejemplo n.º 3
0
    def test_hooks(self):

        set_verbose(True)
        git.genv.ROLE = 'prod'
        git.genv.services = ['git']
        git.clear_caches()

        print('Installing git...')
        git.install_packages() # fails on Ubuntu 14 under Travis-CI?

        print('Setting up sample git repo...')
        run('mkdir /tmp/mygithookrepo || true')
        with cd('/tmp/mygithookrepo'):
            run('git init')
        assert not exists('/tmp/mygithookrepo/.git/hooks/post-checkout')

        print('Configuring git...')
        git.env.enabled = True
        git.env.hooks = {'/tmp/mygithookrepo': ['git/post-checkout']}
        git.clear_local_renderer()
        deploy_satchel.purge()
        cm = git.current_manifest
        print('cm1:', cm)
        assert 'hooks' in cm

        added_hooks, removed_hooks = git.get_changed_hooks()
        print('added_hooks:', added_hooks)
        assert added_hooks == {'/tmp/mygithookrepo': ['git/post-checkout']}
        print('removed_hooks:', removed_hooks)
        assert removed_hooks == {}

        print('Installing git hooks...')
        git.clear_local_renderer()
        git.configure()
        deploy_satchel.purge()
        print('-'*80)
        print('Thumbprinting...')
        #thumbprint(components=git.name)
        deploy_satchel.fake(components=git.name)
        print('-'*80)

        assert exists('/tmp/mygithookrepo/.git/hooks/post-checkout')
Ejemplo n.º 4
0
    def test_hooks(self):

        set_verbose(True)
        git.genv.ROLE = 'prod'
        git.genv.services = ['git']
        git.clear_caches()

        print('Installing git...')
        git.install_packages()  # fails on Ubuntu 14 under Travis-CI?

        print('Setting up sample git repo...')
        run('mkdir /tmp/mygithookrepo || true')
        with cd('/tmp/mygithookrepo'):
            run('git init')
        assert not exists('/tmp/mygithookrepo/.git/hooks/post-checkout')

        print('Configuring git...')
        git.env.enabled = True
        git.env.hooks = {'/tmp/mygithookrepo': ['git/post-checkout']}
        git.clear_local_renderer()
        deploy_satchel.purge()
        cm = git.current_manifest
        print('cm1:', cm)
        assert 'hooks' in cm

        added_hooks, removed_hooks = git.get_changed_hooks()
        print('added_hooks:', added_hooks)
        assert added_hooks == {'/tmp/mygithookrepo': ['git/post-checkout']}
        print('removed_hooks:', removed_hooks)
        assert removed_hooks == {}

        print('Installing git hooks...')
        git.clear_local_renderer()
        git.configure()
        deploy_satchel.purge()
        print('-' * 80)
        print('Thumbprinting...')
        #thumbprint(components=git.name)
        deploy_satchel.fake(components=git.name)
        print('-' * 80)

        assert exists('/tmp/mygithookrepo/.git/hooks/post-checkout')
Ejemplo n.º 5
0
    def test_selenium(self):
        try:
            print('deploy_satchel.env.lockfile_path:', deploy_satchel.env.lockfile_path)
            print('deploy_satchel.env.data_dir:', deploy_satchel.env.data_dir)
            assert deploy_satchel.env.lockfile_path == '/tmp/burlap_unittests/deploy.lock'
            assert deploy_satchel.env.data_dir == '/tmp/burlap_unittests'
            assert deploy_satchel.manifest_filename == '/tmp/burlap_unittests/manifest.yaml'

            set_verbose(True)
            print('selenium.geckodriver_path:', selenium.geckodriver_path)
            selenium.genv.ROLE = 'local'
            selenium.genv.services = ['selenium']
            selenium.clear_caches()

            print('Enabling selenium/gecko to install and track old version.')
            print('selenium._last_manifest.1:', selenium._last_manifest)
            print('selenium.last_manifest.1:', selenium.last_manifest)
            selenium.env.enabled = True
            selenium.env.geckodriver_version = '0.13.0'
            selenium.clear_local_renderer()
            assert selenium.get_target_geckodriver_version_number() == '0.13.0'
            print('Configuring selenium...')
            selenium.configure()
            print('selenium._last_manifest.2:', selenium._last_manifest)
            print('selenium.last_manifest.2:', selenium.last_manifest)
            print('Writing manifest...')
            deploy_satchel.fake(components=selenium.name)
            deploy_satchel.run('ls -lah %s' % deploy_satchel.manifest_filename)
            deploy_satchel.run('cat %s' % deploy_satchel.manifest_filename)
            print('selenium._last_manifest.3:', selenium._last_manifest)
            print('selenium.last_manifest.3:', selenium.last_manifest)

            print('Confirming install succeeded...')
            assert exists(selenium.geckodriver_path)
            assert not selenium.check_for_change()
            output = selenium.run('geckodriver --version')
            print('Geckodriver version:', output)
            expected_version = selenium.env.geckodriver_version
            assert expected_version in output

            print('Updating configuration to track the most recent version...')
            selenium.env.geckodriver_version = None
            selenium.clear_local_renderer()
            assert selenium.get_target_geckodriver_version_number() != '0.13.0'
            assert selenium.last_manifest.fingerprint == '0.13.0'

            print('Confirm we now see a pending change...')
            assert selenium.check_for_change()

            print('-'*80)
            print('Applying change...')
            selenium.configure()
            deploy_satchel.purge()
            print('-'*80)
            print('Thumbprinting...')
            deploy_satchel.fake(components=selenium.name)
            print('-'*80)

            print('Confirming the most recent version was installed...')
            expected_version = selenium.get_most_recent_version()
            selenium.clear_caches()
            assert selenium.last_manifest.fingerprint == expected_version
            output = selenium.run('geckodriver --version')
            expected_version = selenium.get_latest_geckodriver_version_number()
            assert expected_version in output
            assert not selenium.check_for_change()

            print('Update configuration to not manage gecko and apply...')
            selenium.env.enabled = False
            selenium.clear_local_renderer()
            selenium.configure()

            # Confirm gecko was uninstalled.
            assert not exists(selenium.geckodriver_path)

        finally:
            selenium.uninstall_geckodriver()
Ejemplo n.º 6
0
 def thumbprint(self, components=None):
     deploy_satchel.purge()
     deploy_satchel.fake(components=components)