Project

General

Profile

Development #43035

agent déploiement authentic et hobo.json modifié avec de l'info interne (?)

Added by Frédéric Péters 12 days ago. Updated 12 days ago.

Status:
Solution proposée
Priority:
Normal
Category:
-
Target version:
-
Start date:
18 May 2020
Due date:
% Done:

0%

Patch proposed:
Yes
Planning:
No

Description

On trouve dans un hobo.json enregistré dans le tenant d'authentic,

  "services": [
    {
      "$done": true,
      "service-id": "hobo",
      "title": "Hobo",

mais dans le code,

            while retries < max_retries:
                for service in services:
                    if service.get('$done'):
                        continue
...
                    loaded += 1

                if len(services) == loaded:
                    # it's finished no need to continue
                    break

                # wait 5, 10, 20, 40, .. seconds
                time.sleep(self.backoff_factor * (2 ** retries))

résultat on se retrouve là à taper sur le time.sleep() parce que tout est à $done mais loaded est ne monte jamais. (???)

taper ça :

-            loaded = 0
+            loaded = len([x for x in services if x.get('$done')])

?

0002-misc-do-not-wait-already-deployed-SP-43035.patch View (983 Bytes) Benjamin Dauvergne, 18 May 2020 08:45 PM

0001-tests_authentic2-verify-calls-to-sleep-on-redeploy-4.patch View (2.12 KB) Benjamin Dauvergne, 18 May 2020 08:45 PM

History

#2 Updated by Benjamin Dauvergne 12 days ago

  • Assignee set to Benjamin Dauvergne

#3 Updated by Benjamin Dauvergne 12 days ago

tox -e py2-authentic -- tests_authentic -k hobo_deploy

Avant :

        with mock.patch('hobo.agent.authentic2.provisionning.notify_agents') as mock_notify, \
                mock.patch('hobo.agent.authentic2.management.commands.hobo_deploy.sleep', wraps=time.sleep) as sleep_mock:
            call_command('hobo_deploy', redeploy=True)
>       assert sleep_mock.call_count == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = <MagicMock name='sleep' id='140186694722640'>.call_count

tests_authentic/test_hobo_deploy.py:468: AssertionError

Après :

collected 9 items / 7 deselected / 2 selected

tests_authentic/test_hobo_deploy.py ..

#4 Updated by Benjamin Dauvergne 12 days ago

Branche modifiée :
  • j'ai viré loaded qui ne sert plus,
  • et j'ai rajouté un check sur le nombre d'appels à sleep lors du premier hobo_deploy.

Also available in: Atom PDF