Repository: Azure/WALinuxAgent
Pull request #1763 (2020-01-21 15:50:43)

added cbld tests
<!-- DO NOT DELETE THIS TEMPLATE -->

## Description
Fixed CI errors by adding cbld to factory tests and debian distro utils.

Issue # <!-- if any -->
<!--
Please add an informative description that covers that changes made by the pull request. 
This checklist is used to make sure that common issues in a pull request are addressed.
This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
-->

---

### PR information
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).
- [ ] Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made and Travis.CI is passing.

### Quality of Code and Contribution Guidelines
- [ ] I have read the [contribution guidelines](https://github.com/Azure/WALinuxAgent/blob/master/.github/CONTRIBUTING.md).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/azure/walinuxagent/1763)
<!-- Reviewable:end -->



Patch:
diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py
index edbaca30..e65eed95 100644
--- a/azurelinuxagent/common/osutil/factory.py
+++ b/azurelinuxagent/common/osutil/factory.py
@@ -89,7 +89,7 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
         else:
             return SUSEOSUtil()
 
-    if distro_name == ("debian", "cbld"):
+    if distro_name in ("debian", "cbld"):
         if "sid" in distro_version or Version(distro_version) > Version("7"):
             return DebianOSModernUtil()
         else:


Test patch:
diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py
index adc099d5..1506b7a0 100644
--- a/tests/common/osutil/test_factory.py
+++ b/tests/common/osutil/test_factory.py
@@ -173,6 +173,14 @@ class TestOsUtilFactory(AgentTestCase):
         self.assertTrue(type(ret) == DebianOSModernUtil)
         self.assertEquals(ret.get_service_name(), "walinuxagent")
 
+    def test_get_osutil_it_should_return_cbld(self):
+        ret = _get_osutil(distro_name="cbld",
+                          distro_code_name="",
+                          distro_full_name="",
+                          distro_version="10")
+        self.assertTrue(type(ret) == DebianOSModernUtil)
+        self.assertEquals(ret.get_service_name(), "walinuxagent")
+
     def test_get_osutil_it_should_return_redhat(self):
         ret = _get_osutil(distro_name="redhat",
                           distro_code_name="",