#50367 Issue 50164 - Add test for dscreate to basic test suite
Closed 2 years ago by spichugi. Opened 3 years ago by vashirov.
vashirov/389-ds-base dscreate-pythonpath  into  master

@@ -1196,12 +1196,16 @@ 

      with open(template_file, "w") as template_fd:

          template_fd.write(template_text)

  

+     # Unset PYTHONPATH to avoid mixing old CLI tools and new lib389

+     tmp_env = os.environ

+     if "PYTHONPATH" in tmp_env:

+         del tmp_env["PYTHONPATH"]

      try:

          subprocess.check_call([

              'dscreate',

              'from-file',

              template_file

-         ])

+         ], env=tmp_env)

      except subprocess.CalledProcessError as e:

          log.fatal("dscreate failed!  Error ({}) {}".format(e.returncode, e.output))

          assert False

@@ -18,7 +18,8 @@ 

  

  import tempfile

  

- pytestmark = pytest.mark.tier0

+ pytestmark = [pytest.mark.tier0,

+               pytest.mark.skipif(ds_is_older('1.4.1.2'), reason="Needs a compatible systemd unit, see PR#50213")]

  

  INSTANCE_PORT = 54321

  INSTANCE_SERVERID = 'standalone'

@@ -52,8 +52,7 @@ 

               inst.get_changelog_dir(),

               inst.ds_paths.ldif_dir,

               inst.ds_paths.lock_dir,

-              inst.ds_paths.log_dir,

-              "{}/sysconfig/dirsrv-{}".format(inst.ds_paths.sysconf_dir, inst.serverid)]

+              inst.ds_paths.log_dir]

      for path in paths:

          assert not os.path.exists(path)

  

Bug Description:
dscreate tests do not work properly when newer lib389 is used
with older 389-ds-base versions.

Fix Description:

  • Unset PYTHONPATH for dscreate if it's set to prevent clobbering system
    lib389.

  • Don't run dscreate_test on older versions, where instance-specific sysconfig
    env file is mentioned in systemd unit file. dscreate no longer creates it and
    causes dirsrv service fail to start.

  • Don't check for instance-specific sysconfig env file on removing the instance
    since it's no longer created.

Fixes https://pagure.io/389-ds-base/issue/50164

Reviewed by: ???

rebased onto 423a9ce

3 years ago

Pull-Request has been merged by vashirov

3 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3426

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

2 years ago