MCPcopy
hub / github.com/kubernetes/kops / RunGoldenTest

Function RunGoldenTest

pkg/model/openstackmodel/servergroup_test.go:1563–1640  ·  view source on GitHub ↗
(t *testing.T, basedir string, testCase serverGroupModelBuilderTestInput)

Source from the content-addressed store, hash-verified

1561}
1562
1563func RunGoldenTest(t *testing.T, basedir string, testCase serverGroupModelBuilderTestInput) {
1564 h := testutils.NewIntegrationTestHarness(t)
1565 defer h.Close()
1566
1567 h.MockKopsVersion("1.18.0")
1568 testutils.SetupMockOpenstack()
1569
1570 clusterLifecycle := fi.LifecycleSync
1571 bootstrapScriptBuilder := &model.BootstrapScriptBuilder{
1572 KopsModelContext: &model.KopsModelContext{
1573 IAMModelContext: iam.IAMModelContext{Cluster: testCase.cluster},
1574 AllInstanceGroups: testCase.instanceGroups,
1575 InstanceGroups: testCase.instanceGroups,
1576 },
1577 NodeUpConfigBuilder: &nodeupConfigBuilder{},
1578 NodeUpAssets: map[architectures.Architecture]*assets.MirroredAsset{
1579 architectures.ArchitectureAmd64: {
1580 Locations: []string{"nodeup-amd64-1", "nodeup-amd64-2"},
1581 Hash: hashing.MustFromString("833723369ad345a88dd85d61b1e77336d56e61b864557ded71b92b6e34158e6a"),
1582 },
1583 architectures.ArchitectureArm64: {
1584 Locations: []string{"nodeup-arm64-1", "nodeup-arm64-2"},
1585 Hash: hashing.MustFromString("e525c28a65ff0ce4f95f9e730195b4e67fdcb15ceb1f36b5ad6921a8a4490c71"),
1586 },
1587 },
1588 }
1589
1590 builder := createBuilderForCluster(testCase.cluster, testCase.instanceGroups, clusterLifecycle, bootstrapScriptBuilder)
1591
1592 context := &fi.CloudupModelBuilderContext{
1593 Tasks: make(map[string]fi.CloudupTask),
1594 LifecycleOverrides: map[string]fi.Lifecycle{},
1595 }
1596
1597 // We need the CA and service-account for the bootstrap script
1598 caTask := &fitasks.Keypair{
1599 Name: fi.PtrTo(fi.CertificateIDCA),
1600 Subject: "cn=kubernetes",
1601 Type: "ca",
1602 }
1603 context.AddTask(caTask)
1604 for _, keypair := range []string{
1605 "apiserver-aggregator-ca",
1606 "etcd-clients-ca",
1607 "etcd-manager-ca-events",
1608 "etcd-manager-ca-main",
1609 "etcd-peers-ca-events",
1610 "etcd-peers-ca-main",
1611 "service-account",
1612 } {
1613 task := &fitasks.Keypair{
1614 Name: fi.PtrTo(keypair),
1615 Subject: "cn=" + keypair,
1616 Type: "ca",
1617 }
1618 context.AddTask(task)
1619 }
1620 for _, keypair := range []string{

Callers 1

TestServerGroupBuilderFunction · 0.70

Calls 11

CloseMethod · 0.95
MockKopsVersionMethod · 0.95
SetupMockOpenstackFunction · 0.92
MustFromStringFunction · 0.92
PtrToFunction · 0.92
ValidateTasksFunction · 0.92
createBuilderForClusterFunction · 0.85
AddTaskMethod · 0.80
BuildMethod · 0.65
JoinMethod · 0.65

Tested by

no test coverage detected