Skip to content

Add --template-driver option for secrets/configs - #896

Merged
vdemeester merged 1 commit into
docker:masterfrom
thaJeztah:templated-configs-secrets
Feb 22, 2018
Merged

Add --template-driver option for secrets/configs#896
vdemeester merged 1 commit into
docker:masterfrom
thaJeztah:templated-configs-secrets

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

relates to moby/moby#33702

@dnephindnephin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment threadcli/command/config/create_test.go Outdated
return types.ConfigCreateResponse{}, errors.Errorf("expected name %q, got %q", name, spec.Name)
}

if !reflect.DeepEqual(spec.Templating.Name, expectedDriver.Name) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this just a comparing a string? so it could use != ?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

hm, yes, copy-pasta'd from TestSecretCreateWithDriver. Let me update

@thaJeztah
thaJeztahforce-pushed the templated-configs-secrets branch from 18798e8 to 57abb70CompareFebruary 21, 2018 19:34
@codecov-io

codecov-io commented Feb 21, 2018

Copy link
Copy Markdown

Codecov Report

Merging #896 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@ Coverage Diff @@## master #896 +/- ##
==========================================
+ Coverage 53.23% 53.25% +0.02% 
==========================================
Files 258 258 Lines 16347 16357 +10 ==========================================
+ Hits 8702 8711 +9 - Misses 7081 7082 +1 
Partials 564 564

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Thinking if templating-driver or template-driver is the best name; let me know if template-driver is a better name

assert.Equal(t, "ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))
}

func TestConfigCreateWithTemplatingDriver(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Test for config create without driver?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There's a test above that doesn't have a driver, is that what you meant?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should check and make sure Templating is nil in that case, I think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be done already if the test used DeepEqual on the entire spec instead of looking at specific fields. Maybe we should do that here as well.

@dnephin

Copy link
Copy Markdown
Contributor

I like template-driver

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Changed to template-driver

@thaJeztahthaJeztah changed the title Add --templating-driver option for secrets/configsAdd --template-driver option for secrets/configsFeb 21, 2018
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

hmf, secrets side is failing;

Error: expected {Annotations:{Name:foo Labels:map[]} Data:[115 101 99 114 101 116 95 102 111 111 95 98 97 114 10] Driver:<nil> Templating:<nil>}, got {Annotations:{Name:foo Labels:map[]} Data:[115 101 99 114 101 116 95 102 111 111 95 98 97 114 10] Driver:<nil> Templating:<nil>}

But I don't see a different:

{Annotations:{Name:foo Labels:map[]} Data:[115 101 99 114 101 116 95 102 111 111 95 98 97 114 10] Driver:<nil> Templating:<nil>}
{Annotations:{Name:foo Labels:map[]} Data:[115 101 99 114 101 116 95 102 111 111 95 98 97 114 10] Driver:<nil> Templating:<nil>}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

@cpuguy83cpuguy83 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 🐯

Sign up for freeto 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.

6 participants

@thaJeztah@codecov-io@dnephin@vdemeester@cpuguy83@GordonTheTurtle