~ubuntu-branches/ubuntu/vivid/juju/vivid

« back to all changes in this revision

Viewing changes to juju/providers/openstack/tests/test_ports.py

  • Committer: Package Import Robot
  • Author(s): Martin Packman, Clint Byrum, Mark Mims, Martin Packman
  • Date: 2013-04-10 13:57:21 UTC
  • mfrom: (1.1.24)
  • Revision ID: package-import@ubuntu.com-20130410135721-s87t2g5pxe4yxk85
Tags: 0.7-0ubuntu1
[ Clint Byrum ]
* d/p/fix-tests-do-not-use-etc-lsb-release: Dropped, patch applied upstream.
* d/p/maas-tag-conversion.patch: Dropped, patch applied upstream.
* d/juju.docs: Remove examples as they have been dropped upstream.

[ Mark Mims ]
* Add postinst and prerm scripts using update-alternatives to install into
  a versioned location, enabling co-installability with the go juju port.

[ Martin Packman ]
* New upstream release. (lp: #1167921)
* d/p/workaround-lxc-python-env.patch: Workaround regression with local
  provider failing with SyntaxError on running lxc scripts when user has
  Python 3 specific environment variables set. (lp: #1130809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
    def test_open_port(self):
41
41
        """Opening a port adds the rule to the appropriate security group"""
42
 
        self.expect_nova_get("servers/1000/os-security-groups",
 
42
        self.expect_nova_get(
 
43
            "servers/1000/os-security-groups",
43
44
            response={'security_groups': [
44
 
                    {'name': "juju-testing-1", 'id': 1},
45
 
                ]})
 
45
                {'name': "juju-testing-1", 'id': 1, 'rules': []}]})
46
46
        self.expect_create_rule(1, "tcp", 80)
47
47
        self.mocker.replay()
48
48
 
52
52
 
53
53
        def _check_log(_):
54
54
            self.assertIn("Opened 80/tcp on machine '1000'",
55
 
                log.getvalue())
 
55
                          log.getvalue())
56
56
        return deferred.addCallback(_check_log)
57
57
 
 
58
    def test_diablo_hpcloud_ccompatbility(self):
 
59
        """Verify compatibility workarounds for hpcloud/diablo."""
 
60
        self.expect_nova_get(
 
61
            "servers/1000/os-security-groups",
 
62
            response={'security_groups': [
 
63
                {'name': "juju-testing-1", 'id': 1}]})
 
64
 
 
65
        self.expect_nova_get(
 
66
            "os-security-groups/1",
 
67
            response={'security_group': {
 
68
                'name': "juju-testing-1",
 
69
                'id': 1,
 
70
                'rules': [{
 
71
                    'id': 1,
 
72
                    'parent_group_id': 1,
 
73
                    'ip_protocol': 'tcp',
 
74
                    'from_port': 80,
 
75
                    'to_port': 80}]}})
 
76
 
 
77
        self.mocker.replay()
 
78
 
 
79
        machine = NovaProviderMachine('1000', "server1000.testing.invalid")
 
80
        deferred = self.get_provider().get_opened_ports(machine, "1")
 
81
        return deferred.addCallback(self.assertEqual, set([(80, "tcp")]))
 
82
 
58
83
    def test_open_port_missing_group(self):
59
84
        """Missing security group raises an error on deleting port"""
60
85
        self.expect_nova_get("servers/1000/os-security-groups",