test: fix apply-config integration test, bump clusterctl version

Tests for ApplyConfig API were relying on not really supported behavior
of modifying config via the `Provider` interface (and it was "fixed" in
another PR which cleans up such access to the configuration).

Cluster version bumped to try to workaround strange CAPI bootstrap
failures in e2e-capi.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
Andrey Smirnov 2021-03-31 17:32:41 +03:00 committed by talos-bot
parent d812099df3
commit 204caf8eb9
2 changed files with 25 additions and 8 deletions

View File

@ -20,7 +20,7 @@ TALOSCTL_DEFAULT_TARGET := talosctl-$(OPERATING_SYSTEM)
INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$(OPERATING_SYSTEM) INTEGRATION_TEST_DEFAULT_TARGET := integration-test-$(OPERATING_SYSTEM)
INTEGRATION_TEST_PROVISION_DEFAULT_TARGET := integration-test-provision-$(OPERATING_SYSTEM) INTEGRATION_TEST_PROVISION_DEFAULT_TARGET := integration-test-provision-$(OPERATING_SYSTEM)
KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release/v1.21.0-rc.0/bin/$(OPERATING_SYSTEM)/amd64/kubectl KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release/v1.21.0-rc.0/bin/$(OPERATING_SYSTEM)/amd64/kubectl
CLUSTERCTL_VERSION ?= 0.3.14 CLUSTERCTL_VERSION ?= 0.3.15
CLUSTERCTL_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/v$(CLUSTERCTL_VERSION)/clusterctl-$(OPERATING_SYSTEM)-amd64 CLUSTERCTL_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/v$(CLUSTERCTL_VERSION)/clusterctl-$(OPERATING_SYSTEM)-amd64
SONOBUOY_VERSION ?= 0.50.0 SONOBUOY_VERSION ?= 0.50.0
SONOBUOY_URL ?= https://github.com/vmware-tanzu/sonobuoy/releases/download/v$(SONOBUOY_VERSION)/sonobuoy_$(SONOBUOY_VERSION)_$(OPERATING_SYSTEM)_amd64.tar.gz SONOBUOY_URL ?= https://github.com/vmware-tanzu/sonobuoy/releases/download/v$(SONOBUOY_VERSION)/sonobuoy_$(SONOBUOY_VERSION)_$(OPERATING_SYSTEM)_amd64.tar.gz

View File

@ -97,9 +97,16 @@ func (suite *ApplyConfigSuite) TestApply() {
provider, err := suite.readConfigFromNode(nodeCtx) provider, err := suite.readConfigFromNode(nodeCtx)
suite.Assert().Nilf(err, "failed to read existing config from node %q: %w", node, err) suite.Assert().Nilf(err, "failed to read existing config from node %q: %w", node, err)
provider.Machine().Sysctls()[applyConfigTestSysctl] = applyConfigTestSysctlVal cfg, ok := provider.(*v1alpha1.Config)
suite.Require().True(ok)
cfgDataOut, err := provider.Bytes() if cfg.MachineConfig.MachineSysctls == nil {
cfg.MachineConfig.MachineSysctls = make(map[string]string)
}
cfg.MachineConfig.MachineSysctls[applyConfigTestSysctl] = applyConfigTestSysctlVal
cfgDataOut, err := cfg.Bytes()
suite.Assert().Nilf(err, "failed to marshal updated machine config data (node %q): %w", node, err) suite.Assert().Nilf(err, "failed to marshal updated machine config data (node %q): %w", node, err)
suite.AssertRebooted(suite.ctx, node, func(nodeCtx context.Context) error { suite.AssertRebooted(suite.ctx, node, func(nodeCtx context.Context) error {
@ -144,9 +151,16 @@ func (suite *ApplyConfigSuite) TestApplyOnReboot() {
provider, err := suite.readConfigFromNode(nodeCtx) provider, err := suite.readConfigFromNode(nodeCtx)
suite.Require().NoError(err, "failed to read existing config from node %q", node) suite.Require().NoError(err, "failed to read existing config from node %q", node)
provider.Machine().Sysctls()[applyConfigNoRebootTestSysctl] = applyConfigNoRebootTestSysctlVal cfg, ok := provider.(*v1alpha1.Config)
suite.Require().True(ok)
cfgDataOut, err := provider.Bytes() if cfg.MachineConfig.MachineSysctls == nil {
cfg.MachineConfig.MachineSysctls = make(map[string]string)
}
cfg.MachineConfig.MachineSysctls[applyConfigNoRebootTestSysctl] = applyConfigNoRebootTestSysctlVal
cfgDataOut, err := cfg.Bytes()
suite.Require().NoError(err, "failed to marshal updated machine config data (node %q)", node) suite.Require().NoError(err, "failed to marshal updated machine config data (node %q)", node)
_, err = suite.Client.ApplyConfiguration(nodeCtx, &machineapi.ApplyConfigurationRequest{ _, err = suite.Client.ApplyConfiguration(nodeCtx, &machineapi.ApplyConfigurationRequest{
@ -167,10 +181,13 @@ func (suite *ApplyConfigSuite) TestApplyOnReboot() {
applyConfigNoRebootTestSysctlVal, applyConfigNoRebootTestSysctlVal,
) )
// revert back cfg, ok = newProvider.(*v1alpha1.Config)
delete(provider.Machine().Sysctls(), applyConfigNoRebootTestSysctl) suite.Require().True(ok)
cfgDataOut, err = provider.Bytes() // revert back
delete(cfg.MachineConfig.MachineSysctls, applyConfigNoRebootTestSysctl)
cfgDataOut, err = cfg.Bytes()
suite.Require().NoError(err, "failed to marshal updated machine config data (node %q)", node) suite.Require().NoError(err, "failed to marshal updated machine config data (node %q)", node)
_, err = suite.Client.ApplyConfiguration(nodeCtx, &machineapi.ApplyConfigurationRequest{ _, err = suite.Client.ApplyConfiguration(nodeCtx, &machineapi.ApplyConfigurationRequest{