<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/python-cinderclient.git/cinderclient/tests/unit, branch master</title>
<subtitle>opendev.org: openstack/python-cinderclient.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/'/>
<entry>
<title>Merge "Add test coverage for shell snapshot-create w/ metadata"</title>
<updated>2023-02-13T19:26:47+00:00</updated>
<author>
<name>Zuul</name>
<email>zuul@review.opendev.org</email>
</author>
<published>2023-02-13T19:26:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=f045928d823bcec47038e06449a8348cd3e0028c'/>
<id>f045928d823bcec47038e06449a8348cd3e0028c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge "Move print operations to shell_utils"</title>
<updated>2023-01-26T18:13:28+00:00</updated>
<author>
<name>Zuul</name>
<email>zuul@review.opendev.org</email>
</author>
<published>2023-01-26T18:13:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=6579899d3aedfaf041850c10904c9e4769809c20'/>
<id>6579899d3aedfaf041850c10904c9e4769809c20</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Python3.11: fix crashes in ShellTest</title>
<updated>2022-12-21T13:31:33+00:00</updated>
<author>
<name>Cyril Roelandt</name>
<email>cyril@redhat.com</email>
</author>
<published>2022-07-28T18:14:36+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130'/>
<id>20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130</id>
<content type='text'>
In Python3.11, global flags must be placed right at the start of a
regular expression.

The following regex:

	r'.*?(?m)^Lists all volumes.',
must become:

        r'(?m).*?^Lists all volumes.',

However, since we are using re.MULTILINE, we actually do not need to use
a global flag.

This commit fixes the following tests in Python3.11:
- cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv

Closes-Bug: #1983047
Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In Python3.11, global flags must be placed right at the start of a
regular expression.

The following regex:

	r'.*?(?m)^Lists all volumes.',
must become:

        r'(?m).*?^Lists all volumes.',

However, since we are using re.MULTILINE, we actually do not need to use
a global flag.

This commit fixes the following tests in Python3.11:
- cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv

Closes-Bug: #1983047
Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge "Python3.11: Fix argparse-related test failures"</title>
<updated>2022-12-12T23:13:37+00:00</updated>
<author>
<name>Zuul</name>
<email>zuul@review.opendev.org</email>
</author>
<published>2022-12-12T23:13:37+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=9a4a7868b85b025ef68ab5c0e3c0c4d852400f3b'/>
<id>9a4a7868b85b025ef68ab5c0e3c0c4d852400f3b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add test coverage for shell snapshot-create w/ metadata</title>
<updated>2022-11-17T18:32:11+00:00</updated>
<author>
<name>Eric Harney</name>
<email>eharney@redhat.com</email>
</author>
<published>2022-11-07T19:44:51+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=dec8d4a9ee9208b33a08141d04879369d7210da0'/>
<id>dec8d4a9ee9208b33a08141d04879369d7210da0</id>
<content type='text'>
This path is not currently unit tested.

Change-Id: If38c6352f5e1f0a50e4a0d29fbdd5263ccba3b29
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This path is not currently unit tested.

Change-Id: If38c6352f5e1f0a50e4a0d29fbdd5263ccba3b29
</pre>
</div>
</content>
</entry>
<entry>
<title>Move print operations to shell_utils</title>
<updated>2022-11-15T15:12:41+00:00</updated>
<author>
<name>Eric Harney</name>
<email>eharney@redhat.com</email>
</author>
<published>2022-11-09T17:28:38+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=2d7ae2cd38a2194f98b71d4d98c4273e9ad33e72'/>
<id>2d7ae2cd38a2194f98b71d4d98c4273e9ad33e72</id>
<content type='text'>
Move more code to shell_utils that is only used
for shell operations.

The benefit of this is that the cinderclient library
becomes lighter-weight, because users of the lib
no longer have to import prettytable and extra code.

Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move more code to shell_utils that is only used
for shell operations.

The benefit of this is that the cinderclient library
becomes lighter-weight, because users of the lib
no longer have to import prettytable and extra code.

Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle downgraded client for snapshot-create</title>
<updated>2022-11-08T23:48:18+00:00</updated>
<author>
<name>Brian Rosmaita</name>
<email>rosmaita.fossdev@gmail.com</email>
</author>
<published>2022-11-08T16:58:38+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=9df653571d4da06c25222189be27e87a6da75628'/>
<id>9df653571d4da06c25222189be27e87a6da75628</id>
<content type='text'>
When a CLI user specifies --os-volume api-version 3.66, the shell
will execute the appropriate shell code, but if the server only
supports &lt; 3.66, the client is automatically downgraded and correctly
uses the pre-3.66 SnapshotManager.create() method.

In that case, the 'force' parameter, which is technically not allowed
in mv 3.66 (but which silently accepts a True value for backward
compatibility), will have a value of None, which the pre-3.66 code
happily passes to cinder as '"force": null' in the request body, and
which then fails the Block Storage API request-schema check.

Handle this situation by detecting a None 'force' value and setting
it to its pre-3.66 default value of False.

Change-Id: I3ad8283c2a9aaac58c8d2b50fa7ac86b617e5dd3
Closes-bug: #1995883
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a CLI user specifies --os-volume api-version 3.66, the shell
will execute the appropriate shell code, but if the server only
supports &lt; 3.66, the client is automatically downgraded and correctly
uses the pre-3.66 SnapshotManager.create() method.

In that case, the 'force' parameter, which is technically not allowed
in mv 3.66 (but which silently accepts a True value for backward
compatibility), will have a value of None, which the pre-3.66 code
happily passes to cinder as '"force": null' in the request body, and
which then fails the Block Storage API request-schema check.

Handle this situation by detecting a None 'force' value and setting
it to its pre-3.66 default value of False.

Change-Id: I3ad8283c2a9aaac58c8d2b50fa7ac86b617e5dd3
Closes-bug: #1995883
</pre>
</div>
</content>
</entry>
<entry>
<title>Python3.11: Fix argparse-related test failures</title>
<updated>2022-07-28T19:46:35+00:00</updated>
<author>
<name>Cyril Roelandt</name>
<email>cyril@redhat.com</email>
</author>
<published>2022-07-28T18:48:58+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=90eb9d2be62b5eef179edc7d5ab2cb424a6119e0'/>
<id>90eb9d2be62b5eef179edc7d5ab2cb424a6119e0</id>
<content type='text'>
In Python3.11, the following code crashes:

$ cat test.py
import argparse

parser = argparse.ArgumentParser(description='Short sample app')
subparsers = parser.add_subparsers()
subparsers.add_parser('foo')
subparsers.add_parser('foo')

$ python3.11 test.py
Traceback (most recent call last):
  File "/tmp/arg.py", line 6, in &lt;module&gt;
    subparsers.add_parser('foo')
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {foo}: conflicting subparser: foo

It is now forbidden to use add_parser() multiple times with the same
arguments, which is exactly what we do in the following tests:

- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args

In order to fix the tests failures, we make sure to reset the parser and
subparsers before calling add_parser().

While not strictly necessary, we split those tests into two functions,
for readability purposes.

Closes-Bug: #1983054
Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In Python3.11, the following code crashes:

$ cat test.py
import argparse

parser = argparse.ArgumentParser(description='Short sample app')
subparsers = parser.add_subparsers()
subparsers.add_parser('foo')
subparsers.add_parser('foo')

$ python3.11 test.py
Traceback (most recent call last):
  File "/tmp/arg.py", line 6, in &lt;module&gt;
    subparsers.add_parser('foo')
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {foo}: conflicting subparser: foo

It is now forbidden to use add_parser() multiple times with the same
arguments, which is exactly what we do in the following tests:

- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args

In order to fix the tests failures, we make sure to reset the parser and
subparsers before calling add_parser().

While not strictly necessary, we split those tests into two functions,
for readability purposes.

Closes-Bug: #1983054
Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df
</pre>
</div>
</content>
</entry>
<entry>
<title>Add volume reimage command</title>
<updated>2022-02-24T17:43:19+00:00</updated>
<author>
<name>whoami-rajat</name>
<email>rajatdhasmana@gmail.com</email>
</author>
<published>2018-10-01T07:25:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=12075cb71067563f60de929e61f79eae33b2c2ec'/>
<id>12075cb71067563f60de929e61f79eae33b2c2ec</id>
<content type='text'>
A new reimage API will be introduced on cinder API side with
change in depends on. This patch provides the CLI support for
the same by adding a reimage command.

Implements: blueprint add-volume-re-image-api

Change-Id: I37c254d4caf2f416e456ff6a78b5a4df4e08a176
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A new reimage API will be introduced on cinder API side with
change in depends on. This patch provides the CLI support for
the same by adding a reimage command.

Implements: blueprint add-volume-re-image-api

Change-Id: I37c254d4caf2f416e456ff6a78b5a4df4e08a176
</pre>
</div>
</content>
</entry>
<entry>
<title>Support Block Storage API mv 3.66</title>
<updated>2021-09-02T22:48:28+00:00</updated>
<author>
<name>Brian Rosmaita</name>
<email>rosmaita.fossdev@gmail.com</email>
</author>
<published>2021-08-31T23:10:00+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=c3c15f6cb2f50ec5bb2ae561d8fc61f27fae80d2'/>
<id>c3c15f6cb2f50ec5bb2ae561d8fc61f27fae80d2</id>
<content type='text'>
Block Storage API mv 3.66 enables snapshots of in-use volumes
without requiring a 'force' flag.  For backward compatibility,
the API silently accepts force=true, even though the 'force' flag
is considered invalid for that call.  That behavior is replicated
in the client, where --force with a true value is silently accepted.
The --force option is not advertised in the shell and an option
value that doesn't evaluate to true raises an UnsupportedAttribute
error.  Similar behavior from the v3 Snapshot class, except it
raises a ValueError under similar circumstances.

Change-Id: I7408d0e3a5ed7f4cbcaf65cf3434ad60aaed511d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Block Storage API mv 3.66 enables snapshots of in-use volumes
without requiring a 'force' flag.  For backward compatibility,
the API silently accepts force=true, even though the 'force' flag
is considered invalid for that call.  That behavior is replicated
in the client, where --force with a true value is silently accepted.
The --force option is not advertised in the shell and an option
value that doesn't evaluate to true raises an UnsupportedAttribute
error.  Similar behavior from the v3 Snapshot class, except it
raises a ValueError under similar circumstances.

Change-Id: I7408d0e3a5ed7f4cbcaf65cf3434ad60aaed511d
</pre>
</div>
</content>
</entry>
</feed>
