Skip to content

Add live test case for blob copy scenario#2788

Merged
troydai merged 2 commits intoAzure:masterfrom
troydai:storage.test
Apr 10, 2017
Merged

Add live test case for blob copy scenario#2788
troydai merged 2 commits intoAzure:masterfrom
troydai:storage.test

Conversation

@troydai
Copy link
Copy Markdown
Contributor

@troydai troydai commented Apr 6, 2017

There isn't product change included in this pull request.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • The PR has modified HISTORY.rst with an appropriate description of the change (see Modifying change log).

Command Guidelines

  • Each command and parameter have meaningful descriptions.
  • Each new command has a test.

(see Authoring Command Modules)

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 6, 2017

Codecov Report

Merging #2788 into master will increase coverage by <.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2788      +/-   ##
=========================================
+ Coverage   62.89%   62.9%   +<.01%     
=========================================
  Files         480     480              
  Lines       25994   26000       +6     
  Branches     3942    3943       +1     
=========================================
+ Hits        16350   16354       +4     
- Misses       8617    8622       +5     
+ Partials     1027    1024       -3
Impacted Files Coverage Δ
src/azure-cli-testsdk/azure/cli/testsdk/base.py 65.9% <92.3%> (+0.39%) ⬆️
...ource/azure/cli/command_modules/resource/custom.py 50.82% <0%> (-0.11%) ⬇️
...dback/azure/cli/command_modules/feedback/custom.py 34.69% <0%> (ø) ⬆️
src/azure-cli-core/azure/cli/core/util.py 68.99% <0%> (ø) ⬆️
...ure-cli-vm/azure/cli/command_modules/vm/_params.py 96.19% <0%> (ø) ⬆️
...-cli-role/azure/cli/command_modules/role/custom.py 19.28% <0%> (ø) ⬆️
...ure-cli-core/azure/cli/core/commands/validators.py 97.67% <0%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6cf2df4...cb6865d. Read the comment docs.

@troydai
Copy link
Copy Markdown
Contributor Author

troydai commented Apr 7, 2017

/cc @tjprescott

Copy link
Copy Markdown
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions.

container = self.create_container(account_info)

self.cmd('storage container create -n {}'.format(container))
self.storage_cmd('storage blob exists -n {} -c {}', account_info, blob_name, container)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you removed the check from here? If not to check that the output is false, you could just remove this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed. I'll add it back.

JMESPathCheck('properties.contentSettings.contentType', 'application/test-content'),
JMESPathCheck('properties.contentLength', file_size_kb * 1024)])
self.storage_cmd('storage blob show -n {} -c {}', account_info, blob_name, container) \
.assert_with_checks([JMESPathCheck('properties.contentSettings.contentType', 'application/test-content'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is .storage_cmd and why do we have to call .assert_with_checks instead of just using the checks kwarg like you do for regular .cmd?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, following form of signature is supported in Python 3 only

def foo(para_1, para_2, *args, checks=None):
    pass

The parameters after *args is what I envisioned to have. However it is rejected in Python 2. The current form will more fit into a fluent API design.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would request we either make self.cmd support .assert_with_checks as well or that we make self.storage_cmd work with the checks kwarg... or remove it altogether. I don't see what it does that isn't accomplished by simple text replacement of the connection parameters.

My concern is having fragmented methods of accomplishing the same thing making it difficult to recommend to third parties the right way to do things.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_with_checks is supported by self.cmd. It is added to the ExecuteResult.

self.cmd('storage blob show -n {} -c {}'.format(blob_name, container),
checks=JMESPathCheck('name', blob_name)) # TODO: more checks
self.storage_cmd('storage blob show -n {} -c {}', account_info, blob_name, container) \
.assert_with_checks(JMESPathCheck('name', blob_name)) # TODO: more checks
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a good time to do the "TODO: more checks"? Or if you don't think it's necessary, remove the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the TODO

@troydai
Copy link
Copy Markdown
Contributor Author

troydai commented Apr 7, 2017

Ping @tjprescott

Copy link
Copy Markdown
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also update the test authoring help to reference .assert_with_checks.

@troydai troydai merged commit c15c9f0 into Azure:master Apr 10, 2017
@troydai troydai deleted the storage.test branch April 14, 2017 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants