This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add merge workflow between load raw api model and validation (#1270)
* import github.com/imdario/mergo * add merge into loadcontainerservice workflow * put back the testImport versions, glide.yaml and glide.lock are not sync right now
- Loading branch information
1 parent
292153f
commit 13b0143
Showing
30 changed files
with
1,488 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v20160330 | ||
|
||
import ( | ||
"github.com/imdario/mergo" | ||
) | ||
|
||
// Merge existing containerService attribute into cs | ||
func (cs *ContainerService) Merge(ecs *ContainerService) error { | ||
if err := mergo.Merge(cs.Properties.WindowsProfile, | ||
*ecs.Properties.WindowsProfile); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package v20160330 | ||
|
||
import "testing" | ||
|
||
func TestMerge(t *testing.T) { | ||
newCS := &ContainerService{ | ||
Properties: &Properties{ | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "", | ||
}, | ||
}, | ||
} | ||
|
||
existingCS := &ContainerService{ | ||
Properties: &Properties{ | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "existingPassword", | ||
}, | ||
}, | ||
} | ||
if err := newCS.Merge(existingCS); err != nil { | ||
t.Fatalf("unexpectedly detected merge failure, %+v", err) | ||
} | ||
if newCS.Properties.WindowsProfile.AdminPassword != "existingPassword" { | ||
t.Fatalf("unexpected Properties.WindowsProfile.AdminPassword not updated") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package v20160930 | ||
|
||
import ( | ||
"github.com/imdario/mergo" | ||
) | ||
|
||
// Merge existing containerService attribute into cs | ||
func (cs *ContainerService) Merge(ecs *ContainerService) error { | ||
if err := mergo.Merge(cs.Properties.ServicePrincipalProfile, | ||
*ecs.Properties.ServicePrincipalProfile); err != nil { | ||
return err | ||
} | ||
|
||
if err := mergo.Merge(cs.Properties.WindowsProfile, | ||
*ecs.Properties.WindowsProfile); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package v20160930 | ||
|
||
import "testing" | ||
|
||
func TestMerge(t *testing.T) { | ||
newCS := &ContainerService{ | ||
Properties: &Properties{ | ||
ServicePrincipalProfile: &ServicePrincipalProfile{ | ||
ClientID: "fakeID", | ||
Secret: "", | ||
}, | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "", | ||
}, | ||
}, | ||
} | ||
|
||
existingCS := &ContainerService{ | ||
Properties: &Properties{ | ||
ServicePrincipalProfile: &ServicePrincipalProfile{ | ||
ClientID: "existingFakeID", | ||
Secret: "existingSecret", | ||
}, | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "existingPassword", | ||
}, | ||
}, | ||
} | ||
if err := newCS.Merge(existingCS); err != nil { | ||
t.Fatalf("unexpectedly detected merge failure, %+v", err) | ||
} | ||
if newCS.Properties.ServicePrincipalProfile.ClientID != "fakeID" { | ||
t.Fatalf("unexpected Properties.ServicePrincipalProfile.ClientID changed") | ||
} | ||
if newCS.Properties.ServicePrincipalProfile.Secret != "existingSecret" { | ||
t.Fatalf("unexpected Properties.ServicePrincipalProfile.Secret not updated") | ||
} | ||
if newCS.Properties.WindowsProfile.AdminPassword != "existingPassword" { | ||
t.Fatalf("unexpected Properties.WindowsProfile.AdminPassword not updated") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package v20170131 | ||
|
||
import ( | ||
"github.com/imdario/mergo" | ||
) | ||
|
||
// Merge existing containerService attribute into cs | ||
func (cs *ContainerService) Merge(ecs *ContainerService) error { | ||
if err := mergo.Merge(cs.Properties.ServicePrincipalProfile, | ||
*ecs.Properties.ServicePrincipalProfile); err != nil { | ||
return err | ||
} | ||
|
||
if err := mergo.Merge(cs.Properties.WindowsProfile, | ||
*ecs.Properties.WindowsProfile); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package v20170131 | ||
|
||
import "testing" | ||
|
||
func TestMerge(t *testing.T) { | ||
newCS := &ContainerService{ | ||
Properties: &Properties{ | ||
ServicePrincipalProfile: &ServicePrincipalProfile{ | ||
ClientID: "fakeID", | ||
Secret: "", | ||
}, | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "", | ||
}, | ||
}, | ||
} | ||
|
||
existingCS := &ContainerService{ | ||
Properties: &Properties{ | ||
ServicePrincipalProfile: &ServicePrincipalProfile{ | ||
ClientID: "existingFakeID", | ||
Secret: "existingSecret", | ||
}, | ||
WindowsProfile: &WindowsProfile{ | ||
AdminUsername: "azureuser", | ||
AdminPassword: "existingPassword", | ||
}, | ||
}, | ||
} | ||
if err := newCS.Merge(existingCS); err != nil { | ||
t.Fatalf("unexpectedly detected merge failure, %+v", err) | ||
} | ||
if newCS.Properties.ServicePrincipalProfile.ClientID != "fakeID" { | ||
t.Fatalf("unexpected Properties.ServicePrincipalProfile.ClientID changed") | ||
} | ||
if newCS.Properties.ServicePrincipalProfile.Secret != "existingSecret" { | ||
t.Fatalf("unexpected Properties.ServicePrincipalProfile.Secret not updated") | ||
} | ||
if newCS.Properties.WindowsProfile.AdminPassword != "existingPassword" { | ||
t.Fatalf("unexpected Properties.WindowsProfile.AdminPassword not updated") | ||
} | ||
} |
Oops, something went wrong.