[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Thu Mar 7 13:04:02 UTC 2019


The branch, master has been updated
       via  80cf852dbe4 subunit/run.py: change shebang to python3
       via  10109f62ceb tests/auto_log_pass_change.py: only care about the last expected message other than exact messages count
       via  02c7b8c03d4 subunit/run.py: make iso8601 UTC usage python 2/3 compatible
      from  8b18da27cf2 s4-server: Open and close a transaction on sam.ldb at startup

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 80cf852dbe4a8091e81e1515351aff393fc12af5
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Thu Mar 7 12:12:00 2019 +1300

    subunit/run.py: change shebang to python3
    
    always use explicit python version at current stage.
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Thu Mar  7 13:03:56 UTC 2019 on sn-devel-144

commit 10109f62ceb0cb435be3c521bd281eae48077535
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Thu Mar 7 16:10:27 2019 +1300

    tests/auto_log_pass_change.py: only care about the last expected message other than exact messages count
    
    The messages count could be different because of racing condition.
    And we should only care about the last expected one.
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett abartlet at samba.org
    Reviewed-by: Noel Power npower at samba.org

commit 02c7b8c03d4970421a5170e44c57cbc3cda82827
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Thu Mar 7 12:34:15 2019 +1300

    subunit/run.py: make iso8601 UTC usage python 2/3 compatible
    
    In `iso8601/iso8601.py`:
    
        if sys.version_info >= (3, 2, 0):
            UTC = datetime.timezone.utc
            ...
        else:
            class Utc(datetime.tzinfo):
                ...
    
            UTC = Utc()
    
    The class `Utc` is only available for python < 3.2.0.
    Use `UTC` instance instead, which is python 2/3 compatible.
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 python/samba/subunit/run.py                |  8 ++---
 python/samba/tests/auth_log_pass_change.py | 55 +++++++++---------------------
 2 files changed, 20 insertions(+), 43 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py
index 8f32d46ef49..e369b15aa02 100755
--- a/python/samba/subunit/run.py
+++ b/python/samba/subunit/run.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 #
 # Simple subunit testrunner for python
 # Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2014
@@ -24,7 +24,7 @@
   $ python -m samba.subunit.run mylib.tests.test_suite
 """
 
-from iso8601.iso8601 import Utc
+from iso8601.iso8601 import UTC
 
 import datetime
 import os
@@ -184,7 +184,7 @@ class TestProtocolClient(unittest.TestResult):
 
         ":param datetime: A datetime.datetime object.
         """
-        time = a_datetime.astimezone(Utc())
+        time = a_datetime.astimezone(UTC)
         self._stream.write("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
             time.year, time.month, time.day, time.hour, time.minute,
             time.second, time.microsecond))
@@ -458,7 +458,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
         time = self._time
         if time is not None:
             return
-        time = datetime.datetime.utcnow().replace(tzinfo=Utc())
+        time = datetime.datetime.utcnow().replace(tzinfo=UTC)
         self.decorated.time(time)
 
     @property
diff --git a/python/samba/tests/auth_log_pass_change.py b/python/samba/tests/auth_log_pass_change.py
index 99548679a66..0300fbc06d1 100644
--- a/python/samba/tests/auth_log_pass_change.py
+++ b/python/samba/tests/auth_log_pass_change.py
@@ -100,12 +100,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
         net.change_password(newpassword=password,
                             username=USER_NAME,
                             oldpassword=USER_PASS)
-
-        messages = self.waitForMessages(isLastExpectedMessage)
-        print("Received %d messages" % len(messages))
-        self.assertEquals(8,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     def test_admin_change_password_new_password_fails_restriction(self):
         def isLastExpectedMessage(msg):
@@ -136,11 +132,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
             exception_thrown = True
         self.assertEquals(True, exception_thrown,
                           "Expected exception not thrown")
-
-        messages = self.waitForMessages(isLastExpectedMessage)
-        self.assertEquals(8,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     def test_admin_change_password_unknown_user(self):
         def isLastExpectedMessage(msg):
@@ -172,10 +165,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
         self.assertEquals(True, exception_thrown,
                           "Expected exception not thrown")
 
-        messages = self.waitForMessages(isLastExpectedMessage)
-        self.assertEquals(8,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     def test_admin_change_password_bad_original_password(self):
         def isLastExpectedMessage(msg):
@@ -207,10 +198,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
         self.assertEquals(True, exception_thrown,
                           "Expected exception not thrown")
 
-        messages = self.waitForMessages(isLastExpectedMessage)
-        self.assertEquals(8,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     # net rap password changes are broken, but they trigger enough of the
     # server side behaviour to exercise the code paths of interest.
@@ -238,11 +227,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
         call(["bin/net", "rap", server_param,
               "password", USER_NAME, "notMyPassword", "notGoingToBeMyPassword",
               server, creds, "--option=client ipc max protocol=nt1"])
-
-        messages = self.waitForMessages(isLastExpectedMessage)
-        self.assertEquals(7,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     def test_ldap_change_password(self):
         def isLastExpectedMessage(msg):
@@ -266,11 +252,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
             "add: userPassword\n" +
             "userPassword: " + new_password + "\n")
 
-        messages = self.waitForMessages(isLastExpectedMessage)
-        print("Received %d messages" % len(messages))
-        self.assertEquals(4,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     #
     # Currently this does not get logged, so we expect to only see the log
@@ -296,11 +279,8 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
             (num, msg) = e.args
             pass
 
-        messages = self.waitForMessages(isLastExpectedMessage)
-        print("Received %d messages" % len(messages))
-        self.assertEquals(3,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")
 
     def test_ldap_change_password_bad_original_password(self):
         def isLastExpectedMessage(msg):
@@ -330,8 +310,5 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
             (num, msg) = e1.args
             pass
 
-        messages = self.waitForMessages(isLastExpectedMessage)
-        print("Received %d messages" % len(messages))
-        self.assertEquals(4,
-                          len(messages),
-                          "Did not receive the expected number of messages")
+        self.assertTrue(self.waitForMessages(isLastExpectedMessage),
+                        "Did not receive the expected message")


-- 
Samba Shared Repository



More information about the samba-cvs mailing list