Skip to content

Commit

Permalink
wip: works so far - need more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ committed Oct 29, 2024
1 parent c7cd0b6 commit 0580e53
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 60 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,4 @@ replace (
github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37
)

replace github.com/elastic/elastic-agent-libs => github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029074617-85d0f84bdbe4
replace github.com/elastic/elastic-agent-libs => github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029194025-8d35d32c0ac0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029074617-85d0f84bdbe4 h1:zdq61t2xzadaWg0hdolSCikTSirhti4SSX1MaurLa/k=
github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029074617-85d0f84bdbe4/go.mod h1:5CR02awPrBr+tfmjBBK+JI+dMmHNQjpVY24J0wjbC7M=
github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029194025-8d35d32c0ac0 h1:FN3uUIHbiWmKdqfZfWOSBSiEHzWMC/S0HnLkKmAoO+k=
github.com/AndersonQ/elastic-agent-libs v0.0.0-20241029194025-8d35d32c0ac0/go.mod h1:5CR02awPrBr+tfmjBBK+JI+dMmHNQjpVY24J0wjbC7M=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (h *PolicyChangeHandler) Handle(ctx context.Context, a fleetapi.Action, ack
h.log.Debugf("handlerPolicyChange: emit configuration for action %+v", a)
err = h.handlePolicyChange(ctx, c)
if err != nil {
h.log.Errorw("handlerPolicyChange error", "error", err)
return err
}

Expand Down Expand Up @@ -152,6 +153,7 @@ func (h *PolicyChangeHandler) validateFleetServerHosts(ctx context.Context, cfg
updateFleetConfig(h.log, parsedConfig.Fleet.Client, &newFleetClientConfig)

// Test new config
h.log.Infow("PolicyChangeHandler: testFleetConfig", "cfg", newFleetClientConfig)
err = testFleetConfig(ctx, h.log, newFleetClientConfig, h.config.Fleet.AccessAPIKey)
if err != nil {
return nil, fmt.Errorf("validating fleet client config: %w", err)
Expand Down
8 changes: 6 additions & 2 deletions pkg/testing/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,12 @@ type AgentInspectOutput struct {
Threshold int `yaml:"threshold"`
} `yaml:"reporting"`
Ssl struct {
Renegotiation string `yaml:"renegotiation"`
VerificationMode string `yaml:"verification_mode"`
Renegotiation string `yaml:"renegotiation"`
VerificationMode string `yaml:"verification_mode"`
Certificate string `yaml:"certificate"`
CertificateAuthorities []string `yaml:"certificate_authorities"`
Key string `yaml:"key"`
KeyPassphrasePath string `yaml:"key_passphrase_path"`
} `yaml:"ssl"`
Timeout string `yaml:"timeout"`
} `yaml:"fleet"`
Expand Down
5 changes: 3 additions & 2 deletions pkg/testing/fixture_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ func (f *Fixture) installNoPkgManager(ctx context.Context, installOpts *InstallO
}

if keepInstalledFlag() {
f.t.Logf("ignoring AGENT_KEEP_INSTALLED=true as test succeeded, " +
"keeping the agent installed will jeopardise other tests")
return
// f.t.Logf("ignoring AGENT_KEEP_INSTALLED=true as test succeeded, " +
// "keeping the agent installed will jeopardise other tests")
}

// 5 minute timeout, to ensure that it at least doesn't get stuck.
Expand Down
Loading

0 comments on commit 0580e53

Please sign in to comment.