Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit test which covers imagename creation with registries on non default ports. #782

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aidun
Copy link
Contributor

@aidun aidun commented Mar 18, 2020

Added unit test which covers imagename creation with registries on non default ports.

Description

Motivation and Context

  • I have raised an issue to propose this change (required)

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • [] All new and existing tests passed.

@alexellis alexellis requested a review from viveksyngh March 19, 2020 08:12
@alexellis
Copy link
Member

@aidun please can you fix the CI failure? You should have seen this when the PR was raised, but if you missed it, pleased take a look.

Also the commit message is truncated for the commit subject, I think we've spoken about this before, but if in doubt, see the contributing guide for how to wrap the commit message.

https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md#commit-messages

@aidun
Copy link
Contributor Author

aidun commented Mar 19, 2020

This is a PR to show the tests are failing. You ask me to do it. Because of this it is a draft.

I this is okay, I have to fix the function. Then I will provide a polished PR.

Maybe I miss understood you on slack.

@alexellis
Copy link
Member

OK no problem.

Are you planning on then going on to fix the code, now that you have a failing test? :-)

Alex

@aidun
Copy link
Contributor Author

aidun commented Mar 19, 2020

I will provide a fix in the next days.

@aidun
Copy link
Contributor Author

aidun commented Mar 22, 2020

@alexellis I provided a fix for the issue. I dont feel comfortable with it, because I found no "good" way to check it. Maybe you or someone other can provide feedback on this.

@alexellis
Copy link
Member

@viveksyngh a review has been requested.

@alexellis
Copy link
Member

Sorry that you haven't had a review yet. Let me see if @LucasRoesler has some time to take a quick look. The unit test looks good, but do we have a unit test that checks that the old behaviour still works? (we may already have it)

Lucas I think we were just looking for some advice on the style / approach on checking the implementation.

@LucasRoesler
Copy link
Member

@aidun you mention that you are unhappy with the solution. Can you explain what you don't like about it?


func Test_BuildImageName_RegistryWithPort(t *testing.T) {
want := "registry.domain:8080/image:latest"
got := BuildImageName(DefaultFormat, "registry.domain:8080/image", "ef384", "master")
Copy link
Member

Choose a reason for hiding this comment

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

I think it is probably a good idea to also include one case with a port and a tag, e.g. registry.domain:8080/image:foo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a new version with that. Thank you for the hint.

@aidun
Copy link
Contributor Author

aidun commented May 2, 2020

@LucasRoesler I don't feel comfortable with string operations and try to avoid such implementations. If you think it is okay, everything is fine.

- Added unit test which covers imagename creation with registries on non default ports.
- Added fix for BuildImageName on registries on non default ports

Signed-off-by: Markus Hartmann <[email protected]>
@aidun aidun force-pushed the registry_test branch from 3adf24a to f50137f Compare May 2, 2020 13:43
@alexellis
Copy link
Member

@LucasRoesler can you take a fresh look at this please?

Copy link
Member

@LucasRoesler LucasRoesler left a comment

Choose a reason for hiding this comment

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

i think it looks good, let's merge it

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.

3 participants