#48431 lib389 integrate ldclt
Closed: wontfix None Opened 6 years ago by firstyear.

We often use ldclt to demonstrate issues with 389. We should integrate this into lib389 so that we can provide these in unit tests.


Wow, it would really useful and will help a lot! Thanks!

Also, we can expend its usability with making users "template" the input parameter. Current value would be default in this case. If you have time for this small change now, it would be great if you modify your patch like this. :)

About your test. It isn't quite accurate.
First, your finalizer has the commented line "#instance.delete()".
Second, your test case "test_ldctl" just run your functions. Can you please add a check and an assertion for the amount of added entries?

Replying to [comment:3 spichugi]:

Also, we can expend its usability with making users "template" the input parameter. Current value would be default in this case. If you have time for this small change now, it would be great if you modify your patch like this. :)

The idea was to make this simple: Where you can just say "create me X number of users" and it does.

The main issue I have about overriding the template is when someone says 'ohh can we add a second counter', or 'can we add other random feature X'. Then we end up re-implementing all the functionality from scratch.

However, there are cases where the template may wish to be overridden. For example objectClasses.

For now, I'll allow the template to be specified, but I'm going to take a tough stance on complexity in this module.

About your test. It isn't quite accurate.
First, your finalizer has the commented line "#instance.delete()".

Fixed.

Second, your test case "test_ldctl" just run your functions. Can you please add a check and an assertion for the amount of added entries?

If the users don't exist, the bind_loadtest will fail, causing the exception and the test to fail.

I've added the assert for now, but it feels redundant to me.

Hi William,

krb5_create_test.py and ldclt_test.py tests have failed with your patch.

'''krb5_create_test.py'''
{{{

  secure_password = [random.choice(string.letters) for x in xrange(64)]

E NameError: global name 'random' is not defined
}}}

'''ldclt_test.py'''
{{{
try:
result = subprocess.check_output(cmd)
# If verbose, capture / log the output.
except subprocess.CalledProcessError as e:
print(' '.join(cmd) )
print(result)

      raise(e)

E CalledProcessError: Command '['//bin/ldclt-bin', '-h', 'localhost.localdomain', '-p', '54321', '-N', '3', '-D', 'uid=userXXXX,ou=People,dc=example,dc=com', '-w', 'userXXXX', '-e', 'randombinddn,randombinddnlow=1000,randombinddn
high=1999', '-e', 'bindonly']' returned non-zero exit status -11
}}}

Replying to [comment:4 firstyear]:

Replying to [comment:3 spichugi]:

Also, we can expend its usability with making users "template" the input parameter. Current value would be default in this case. If you have time for this small change now, it would be great if you modify your patch like this. :)

The idea was to make this simple: Where you can just say "create me X number of users" and it does.

The main issue I have about overriding the template is when someone says 'ohh can we add a second counter', or 'can we add other random feature X'. Then we end up re-implementing all the functionality from scratch.

However, there are cases where the template may wish to be overridden. For example objectClasses.

Yeah, that's the point. Sometimes we need to add some additional attributes. And for now, I think we can use only one counter.

For now, I'll allow the template to be specified, but I'm going to take a tough stance on complexity in this module.

Thanks!

Second, your test case "test_ldctl" just run your functions. Can you please add a check and an assertion for the amount of added entries?

If the users don't exist, the bind_loadtest will fail, causing the exception and the test to fail.

I've added the assert for now, but it feels redundant to me.

Thank you! In my opinion, we should cover expected functionality with unit tests, especially if it is not very complex.

In the future, source code may changes and there will be no exception, but we will have lesser quantity of users in the result (by some reason).

P.S. if you add some additional changes to the code, can you please describe in the commit message what you did and why? Just for order. :)

Sorry, the krb changes were not meant to go into this ticket. That was an accident.

'''ldclt_test.py'''

{{{
try:
result = subprocess.check_output(cmd)
# If verbose, capture / log the output.
except subprocess.CalledProcessError as e:
print(' '.join(cmd) )
print(result)

      raise(e)

E CalledProcessError: Command '['//bin/ldclt-bin', '-h', 'localhost.localdomain', '-p', '54321', '-N', '3', '-D', 'uid=userXXXX,ou=People,dc=example,dc=com', '-w', 'userXXXX', '-e', 'randombinddn,randombinddnlow=1000,randombinddn
high=1999', '-e', 'bindonly']' returned non-zero exit status -11
}}}

This error remains the same. Unfortunately, I don't have much time to find the core of the problem with the command. I will check later, if you want.

Highly likely that you are missing localhost.localdomain from your hosts file.

This fixes the test to use the short-hostname allocation which should always work.

Ack, test passed. The problem was because of a bug.

Exit status -11 is a segmentation fault. It is related to #48400. I've tested with a new build and everything went smoothly.

commit ab53dcae2fdb55f7bea4976e142f62feb1bf7b59
Writing objects: 100% (7/7), 2.89 KiB | 0 bytes/s, done.
Total 7 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/lib389.git
f320ad5..ab53dca master -> master

Metadata Update from @firstyear:
- Issue assigned to firstyear
- Issue set to the milestone: lib389 1.0.2

5 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 issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1760

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

2 years ago

Login to comment on this ticket.

Metadata