
from neutron.tests.functional.agent.l2 import base


class TestOVSAgentSfcExtension(base.OVSAgentTestFramework):
    def setUp(self):
        super(TestOVSAgentSfcExtension, self).setUp()
        self.config.set_override('extensions', ['sfc'], 'agent')

    def test_run(self):
        agent = self.create_agent()
        self.start_agent(agent)
        agent_state = agent.state_rpc.report_state.call_args[0][1]
        self.assertEqual(['sfc'], agent_state['configurations']['extensions'])


from neutron.tests.functional.agent.l2 import base


class TestOVSAgentSfcExtension(base.OVSAgentTestFramework):
    def setUp(self):
        super(TestOVSAgentSfcExtension, self).setUp()
        self.config.set_override('extensions', ['sfc'], 'agent')
        self.agent = self.create_agent()

    def test_run(self):
        self.agent._report_state()
        agent_state = self.agent.state_rpc.report_state.call_args[0][1]
        self.assertEqual(['sfc'], agent_state['configurations']['extensions'])

Fix extension loading functional test
Fix extension loading functional test

Call the agent _report_state() before checking the report state itself

Change-Id: Idbf552d5ca5968bc95b0a3c395499c3f2d215729
Closes-Bug: 1658089

  
  from neutron.tests.functional.agent.l2 import base
  
  
  class TestOVSAgentSfcExtension(base.OVSAgentTestFramework):
      def setUp(self):
          super(TestOVSAgentSfcExtension, self).setUp()
          self.config.set_override('extensions', ['sfc'], 'agent')
+         self.agent = self.create_agent()
  
      def test_run(self):
+         self.agent._report_state()
-         agent = self.create_agent()
-         self.start_agent(agent)
-         agent_state = agent.state_rpc.report_state.call_args[0][1]
+         agent_state = self.agent.state_rpc.report_state.call_args[0][1]
          self.assertEqual(['sfc'], agent_state['configurations']['extensions'])
  
Fix extension loading functional test
## Code Before:

from neutron.tests.functional.agent.l2 import base


class TestOVSAgentSfcExtension(base.OVSAgentTestFramework):
    def setUp(self):
        super(TestOVSAgentSfcExtension, self).setUp()
        self.config.set_override('extensions', ['sfc'], 'agent')

    def test_run(self):
        agent = self.create_agent()
        self.start_agent(agent)
        agent_state = agent.state_rpc.report_state.call_args[0][1]
        self.assertEqual(['sfc'], agent_state['configurations']['extensions'])

## Instruction:
Fix extension loading functional test
## Code After:

from neutron.tests.functional.agent.l2 import base


class TestOVSAgentSfcExtension(base.OVSAgentTestFramework):
    def setUp(self):
        super(TestOVSAgentSfcExtension, self).setUp()
        self.config.set_override('extensions', ['sfc'], 'agent')
        self.agent = self.create_agent()

    def test_run(self):
        self.agent._report_state()
        agent_state = self.agent.state_rpc.report_state.call_args[0][1]
        self.assertEqual(['sfc'], agent_state['configurations']['extensions'])
