Exemplo n.º 1
0
 def test_reload_env_skips_plugins(self):
     sr = {
         "statuses": {
             "name": "name",
             "plugin:tsuru-circus-ApprcWatcher": "ok"
         }
     }
     fake_call, kw = create_fake_call(sr)
     plugin = ApprcWatcher("", "", 1)
     plugin.call = fake_call
     plugin.apprc = os.path.join(os.path.dirname(__file__),
                                 "testdata/apprc")
     plugin.reload_env()
     env = {
         "VAR1": "value-1",
         "port": "8888",
         "VAR2": "value2",
         "PORT": "8888"
     }
     env.update(os.environ)
     expected = [
         {
             "name": "name",
             "options": {
                 "env": env
             }
         },
     ]
     self.assertEqual(expected, kw)
Exemplo n.º 2
0
 def test_reload_env_add_envs(self):
     sr = {"statuses": {"name": "name", "cmd": "cmd"}}
     fake_call, kw = create_fake_call(sr)
     plugin = ApprcWatcher("", "", 1)
     plugin.call = fake_call
     plugin.apprc = os.path.join(os.path.dirname(__file__),
                                 "testdata/apprc")
     plugin.reload_env()
     env = {
         "VAR1": "value-1",
         "port": "8888",
         "VAR2": "value2",
         "PORT": "8888"
     }
     env.update(os.environ)
     expected = [
         {
             "name": "cmd",
             "options": {
                 "env": env
             }
         },
         {
             "name": "name",
             "options": {
                 "env": env
             }
         },
     ]
     self.assertEqual(expected, sorted(kw, key=lambda x: x["name"]))
Exemplo n.º 3
0
 def test_reload_env_skips_plugins(self):
     sr = {"statuses": {"name": "name",
                        "plugin:tsuru-circus-ApprcWatcher": "ok"}}
     fake_call, kw = create_fake_call(sr)
     plugin = ApprcWatcher("", "", 1)
     plugin.call = fake_call
     plugin.apprc = os.path.join(os.path.dirname(__file__),
                                 "testdata/apprc")
     plugin.reload_env()
     env = {"VAR1": "value-1", "port": "8888", "VAR2": "value2"}
     env.update(os.environ)
     expected = [
         {"name": "name", "options": {"env": env}},
     ]
     self.assertEqual(expected, kw)
Exemplo n.º 4
0
 def test_reload_env_add_envs(self):
     sr = {"statuses": {"name": "name", "cmd": "cmd"}}
     fake_call, kw = create_fake_call(sr)
     plugin = ApprcWatcher("", "", 1)
     plugin.call = fake_call
     plugin.apprc = os.path.join(os.path.dirname(__file__),
                                 "testdata/apprc")
     plugin.reload_env()
     env = {"VAR1": "value-1", "port": "8888", "VAR2": "value2"}
     env.update(os.environ)
     expected = [
         {"name": "cmd", "options": {"env": env}},
         {"name": "name", "options": {"env": env}},
     ]
     self.assertEqual(expected, sorted(kw, key=lambda x: x["name"]))