Skip to content

Commit 9f3bf2b

Browse files
[Bot] Add automatically generated go documentation (#1666)
Co-authored-by: Tofel <[email protected]>
1 parent da05acd commit 9f3bf2b

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

framework/clclient/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,8 @@ func (c *ChainlinkClient) GetForwarders() (*Forwarders, *http.Response, error) {
12401240
return response, resp.RawResponse, err
12411241
}
12421242

1243+
// NewETHKey generates a new Ethereum key pair and encrypts the private key using the provided password.
1244+
// It returns the encrypted key in JSON format and the corresponding Ethereum address, or an error if the process fails.
12431245
func NewETHKey(password string) ([]byte, common.Address, error) {
12441246
privateKey, err := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
12451247
var address common.Address

framework/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func (d *JSONStrDuration) UnmarshalJSON(b []byte) error {
236236
}
237237
}
238238

239+
// MustParseDuration parses a duration string in Go's format and returns the corresponding time.Duration.
240+
// It panics if the string cannot be parsed, ensuring that the caller receives a valid duration.
239241
func MustParseDuration(s string) time.Duration {
240242
d, err := time.ParseDuration(s)
241243
if err != nil {

havoc/chaos.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ type ChaosOpts struct {
5353
Remove bool
5454
}
5555

56+
// NewChaos creates a new Chaos instance based on the provided options.
57+
// It requires a client, a chaos object, and a logger to function properly.
58+
// This function is essential for initializing chaos experiments in a Kubernetes environment.
5659
func NewChaos(opts ChaosOpts) (*Chaos, error) {
5760
if opts.Client == nil {
5861
return nil, errors.New("client is required")
@@ -161,6 +164,8 @@ func (c *Chaos) Resume(ctx context.Context) error {
161164
return nil
162165
}
163166

167+
// Delete stops the chaos operation, updates its status, and removes the chaos object if specified.
168+
// It notifies listeners of the operation's completion and handles any errors encountered during the process.
164169
func (c *Chaos) Delete(ctx context.Context) error {
165170
defer func() {
166171
// Cancel the monitoring goroutine

havoc/range_grafana_annotator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,6 @@ func (l RangeGrafanaAnnotator) OnChaosEnded(chaos Chaos) {
150150
l.chaosMap[chaos.GetChaosName()] = res.ID
151151
}
152152

153+
// OnChaosStatusUnknown handles the event when the status of a chaos experiment is unknown.
154+
// It allows listeners to respond appropriately to this specific status change in the chaos lifecycle.
153155
func (l RangeGrafanaAnnotator) OnChaosStatusUnknown(chaos Chaos) {}

havoc/single_line_grafana_annotator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,6 @@ func (l SingleLineGrafanaAnnotator) OnChaosEnded(chaos Chaos) {
134134
l.logger.Debug().Any("GrafanaResponse", resp.String()).Msg("Annotated chaos experiment end")
135135
}
136136

137+
// OnChaosStatusUnknown handles the event when the status of a chaos experiment is unknown.
138+
// It allows listeners to respond appropriately to this specific status change in the chaos lifecycle.
137139
func (l SingleLineGrafanaAnnotator) OnChaosStatusUnknown(chaos Chaos) {}

havoc/template.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ type PodPartitionCfg struct {
4545
ExperimentCreateDelay time.Duration
4646
}
4747

48+
// RunPodPartition initiates a network partition chaos experiment on specified pods.
49+
// It configures the experiment based on the provided PodPartitionCfg and executes it.
50+
// This function is useful for testing the resilience of applications under network partition scenarios.
4851
func (cr *NamespaceScopedChaosRunner) RunPodPartition(ctx context.Context, cfg PodPartitionCfg) (*Chaos, error) {
4952
experiment, err := NewChaos(ChaosOpts{
5053
Object: &v1alpha1.NetworkChaos{
@@ -115,6 +118,9 @@ type PodDelayCfg struct {
115118
ExperimentCreateDelay time.Duration
116119
}
117120

121+
// RunPodDelay initiates a network delay chaos experiment on specified pods.
122+
// It configures the delay parameters and applies them to the targeted namespace.
123+
// This function is useful for testing the resilience of applications under network latency conditions.
118124
func (cr *NamespaceScopedChaosRunner) RunPodDelay(ctx context.Context, cfg PodDelayCfg) (*Chaos, error) {
119125
experiment, err := NewChaos(ChaosOpts{
120126
Object: &v1alpha1.NetworkChaos{
@@ -174,6 +180,9 @@ type PodFailCfg struct {
174180
ExperimentCreateDelay time.Duration
175181
}
176182

183+
// RunPodFail initiates a pod failure experiment based on the provided configuration.
184+
// It creates a Chaos object that simulates pod failures for a specified duration,
185+
// allowing users to test the resilience of their applications under failure conditions.
177186
func (cr *NamespaceScopedChaosRunner) RunPodFail(ctx context.Context, cfg PodFailCfg) (*Chaos, error) {
178187
experiment, err := NewChaos(ChaosOpts{
179188
Description: cfg.Description,
@@ -233,6 +242,9 @@ type NodeCPUStressConfig struct {
233242
ExperimentCreateDelay time.Duration
234243
}
235244

245+
// RunPodStressCPU initiates a CPU stress test on specified pods within a namespace.
246+
// It creates a scheduled chaos experiment that applies CPU load based on the provided configuration.
247+
// This function is useful for testing the resilience of applications under CPU stress conditions.
236248
func (cr *NamespaceScopedChaosRunner) RunPodStressCPU(ctx context.Context, cfg NodeCPUStressConfig) (*Chaos, error) {
237249
experiment, err := NewChaos(ChaosOpts{
238250
Description: cfg.Description,

seth/client_builder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ func (c *ClientBuilder) WithEthClient(ethclient simulated.Client) *ClientBuilder
366366
return c
367367
}
368368

369+
// WithHooks sets the hooks for the ClientBuilder configuration.
370+
// It allows users to customize behavior during client operations
371+
// by providing a set of hooks to be executed at specific events.
369372
func (c *ClientBuilder) WithHooks(hooks Hooks) *ClientBuilder {
370373
c.config.Hooks = &hooks
371374
return c

0 commit comments

Comments
 (0)