Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changes for upgrading go-version to 1.20 in litmus-go #662

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0

- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0

- uses: actions/checkout@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0
- uses: actions/checkout@v2

#TODO: Add Dockerfile linting
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0
- uses: actions/checkout@v2

- name: Set up QEMU
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0
- uses: actions/checkout@v2

#TODO: Add Dockerfile linting
Expand All @@ -28,7 +28,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0
- uses: actions/checkout@v2

- name: Set Tag
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-e2e-on-pr-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0

- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0

- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20.0

- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Multi-stage docker build
# Build stage
FROM golang:1.18 AS builder
FROM golang:1.20 AS builder

ARG TARGETOS=linux
ARG TARGETARCH
Expand Down
10 changes: 5 additions & 5 deletions chaoslib/litmus/container-kill/helper/container-kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func validate(t targetDetails, timeout, delay int, clients clients.ClientSets) e
return verifyRestartCount(t, timeout, delay, clients, t.RestartCountBefore)
}

//stopContainerdContainer kill the application container
// stopContainerdContainer kill the application container
func stopContainerdContainer(containerIDs []string, socketPath, signal, source string) error {
if signal != "SIGKILL" && signal != "SIGTERM" {
return cerrors.Error{ErrorCode: cerrors.ErrorTypeHelper, Source: source, Reason: fmt.Sprintf("unsupported signal %s, use either SIGTERM or SIGKILL", signal)}
Expand All @@ -192,7 +192,7 @@ func stopContainerdContainer(containerIDs []string, socketPath, signal, source s
return nil
}

//stopDockerContainer kill the application container
// stopDockerContainer kill the application container
func stopDockerContainer(containerIDs []string, socketPath, signal, source string) error {
var errOut, out bytes.Buffer
cmd := exec.Command("sudo", "docker", "--host", fmt.Sprintf("unix://%s", socketPath), "kill", "--signal", signal)
Expand All @@ -205,7 +205,7 @@ func stopDockerContainer(containerIDs []string, socketPath, signal, source strin
return nil
}

//getRestartCount return the restart count of target container
// getRestartCount return the restart count of target container
func getRestartCount(target targetDetails, clients clients.ClientSets) (int, error) {
pod, err := clients.KubeClient.CoreV1().Pods(target.Namespace).Get(context.Background(), target.Name, v1.GetOptions{})
if err != nil {
Expand All @@ -221,7 +221,7 @@ func getRestartCount(target targetDetails, clients clients.ClientSets) (int, err
return restartCount, nil
}

//verifyRestartCount verify the restart count of target container that it is restarted or not after chaos injection
// verifyRestartCount verify the restart count of target container that it is restarted or not after chaos injection
func verifyRestartCount(t targetDetails, timeout, delay int, clients clients.ClientSets, restartCountBefore int) error {

restartCountAfter := 0
Expand All @@ -247,7 +247,7 @@ func verifyRestartCount(t targetDetails, timeout, delay int, clients clients.Cli
})
}

//getENV fetches all the env variables from the runner pod
// getENV fetches all the env variables from the runner pod
func getENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "")
experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "")
Expand Down
6 changes: 3 additions & 3 deletions chaoslib/litmus/container-kill/lib/container-kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//PrepareContainerKill contains the preparation steps before chaos injection
// PrepareContainerKill contains the preparation steps before chaos injection
func PrepareContainerKill(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

var err error
Expand Down Expand Up @@ -280,8 +280,8 @@ func getPodEnv(experimentsDetails *experimentTypes.ExperimentDetails, targets st
return envDetails.ENV
}

//SetChaosTunables will setup a random value within a given range of values
//If the value is not provided in range it'll setup the initial provided value.
// SetChaosTunables will setup a random value within a given range of values
// If the value is not provided in range it'll setup the initial provided value.
func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.PodsAffectedPerc = common.ValidateRange(experimentsDetails.PodsAffectedPerc)
experimentsDetails.Sequence = common.GetRandomSequence(experimentsDetails.Sequence)
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/disk-fill/lib/disk-fill.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//PrepareDiskFill contains the preparation steps before chaos injection
// PrepareDiskFill contains the preparation steps before chaos injection
func PrepareDiskFill(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

var err error
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/http-chaos/lib/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/sirupsen/logrus"
)

//PodHttpModifyHeaderChaos contains the steps to prepare and inject http modify header chaos
// PodHttpModifyHeaderChaos contains the steps to prepare and inject http modify header chaos
func PodHttpModifyHeaderChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{
Expand Down
6 changes: 3 additions & 3 deletions chaoslib/litmus/http-chaos/lib/http-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//PrepareAndInjectChaos contains the preparation & injection steps
// PrepareAndInjectChaos contains the preparation & injection steps
func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, args string) error {

var err error
Expand Down Expand Up @@ -284,8 +284,8 @@ func getPodEnv(experimentsDetails *experimentTypes.ExperimentDetails, targets, a
return envDetails.ENV
}

//SetChaosTunables will set up a random value within a given range of values
//If the value is not provided in range it'll set up the initial provided value.
// SetChaosTunables will set up a random value within a given range of values
// If the value is not provided in range it'll set up the initial provided value.
func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.PodsAffectedPerc = common.ValidateRange(experimentsDetails.PodsAffectedPerc)
experimentsDetails.Sequence = common.GetRandomSequence(experimentsDetails.Sequence)
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/http-chaos/lib/latency/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/sirupsen/logrus"
)

//PodHttpLatencyChaos contains the steps to prepare and inject http latency chaos
// PodHttpLatencyChaos contains the steps to prepare and inject http latency chaos
func PodHttpLatencyChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/http-chaos/lib/reset/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/sirupsen/logrus"
)

//PodHttpResetPeerChaos contains the steps to prepare and inject http reset peer chaos
// PodHttpResetPeerChaos contains the steps to prepare and inject http reset peer chaos
func PodHttpResetPeerChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

log.InfoWithValues("[Info]: The chaos tunables are:", logrus.Fields{
Expand Down
4 changes: 2 additions & 2 deletions chaoslib/litmus/network-chaos/helper/netem.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func Helper(clients clients.ClientSets) {

}

//preparePodNetworkChaos contains the prepration steps before chaos injection
// preparePodNetworkChaos contains the prepration steps before chaos injection
func preparePodNetworkChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error {

targetEnv := os.Getenv("TARGETS")
Expand Down Expand Up @@ -295,7 +295,7 @@ type targetDetails struct {
Source string
}

//getENV fetches all the env variables from the runner pod
// getENV fetches all the env variables from the runner pod
func getENV(experimentDetails *experimentTypes.ExperimentDetails) {
experimentDetails.ExperimentName = types.Getenv("EXPERIMENT_NAME", "")
experimentDetails.InstanceID = types.Getenv("INSTANCE_ID", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/litmuschaos/litmus-go/pkg/types"
)

//PodNetworkCorruptionChaos contains the steps to prepare and inject chaos
// PodNetworkCorruptionChaos contains the steps to prepare and inject chaos
func PodNetworkCorruptionChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

args := "corrupt " + experimentsDetails.NetworkPacketCorruptionPercentage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/litmuschaos/litmus-go/pkg/types"
)

//PodNetworkDuplicationChaos contains the steps to prepare and inject chaos
// PodNetworkDuplicationChaos contains the steps to prepare and inject chaos
func PodNetworkDuplicationChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

args := "duplicate " + experimentsDetails.NetworkPacketDuplicationPercentage
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/network-chaos/lib/latency/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/litmuschaos/litmus-go/pkg/types"
)

//PodNetworkLatencyChaos contains the steps to prepare and inject chaos
// PodNetworkLatencyChaos contains the steps to prepare and inject chaos
func PodNetworkLatencyChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

args := "delay " + strconv.Itoa(experimentsDetails.NetworkLatency) + "ms " + strconv.Itoa(experimentsDetails.Jitter) + "ms"
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/network-chaos/lib/loss/loss.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/litmuschaos/litmus-go/pkg/types"
)

//PodNetworkLossChaos contains the steps to prepare and inject chaos
// PodNetworkLossChaos contains the steps to prepare and inject chaos
func PodNetworkLossChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

args := "loss " + experimentsDetails.NetworkPacketLossPercentage
Expand Down
6 changes: 3 additions & 3 deletions chaoslib/litmus/network-chaos/lib/network-chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var serviceMesh = []string{"istio", "envoy"}
var destIpsSvcMesh string
var destIps string

//PrepareAndInjectChaos contains the preparation & injection steps
// PrepareAndInjectChaos contains the preparation & injection steps
func PrepareAndInjectChaos(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, args string) error {

var err error
Expand Down Expand Up @@ -411,8 +411,8 @@ func getIpsForTargetHosts(targetHosts string, clients clients.ClientSets, servic
return strings.Join(commaSeparatedIPs, ","), nil
}

//SetChaosTunables will set up a random value within a given range of values
//If the value is not provided in range it'll set up the initial provided value.
// SetChaosTunables will set up a random value within a given range of values
// If the value is not provided in range it'll set up the initial provided value.
func SetChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.NetworkPacketLossPercentage = common.ValidateRange(experimentsDetails.NetworkPacketLossPercentage)
experimentsDetails.NetworkPacketCorruptionPercentage = common.ValidateRange(experimentsDetails.NetworkPacketCorruptionPercentage)
Expand Down
6 changes: 3 additions & 3 deletions chaoslib/litmus/node-cpu-hog/lib/node-cpu-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func injectChaosInParallelMode(experimentsDetails *experimentTypes.ExperimentDet
return nil
}

//setCPUCapacity fetch the node cpu capacity
// setCPUCapacity fetch the node cpu capacity
func setCPUCapacity(experimentsDetails *experimentTypes.ExperimentDetails, appNode string, clients clients.ClientSets) error {
node, err := clients.KubeClient.CoreV1().Nodes().Get(context.Background(), appNode, v1.GetOptions{})
if err != nil {
Expand Down Expand Up @@ -278,8 +278,8 @@ func createHelperPod(experimentsDetails *experimentTypes.ExperimentDetails, chao
return nil
}

//setChaosTunables will set up a random value within a given range of values
//If the value is not provided in range it'll set up the initial provided value.
// setChaosTunables will set up a random value within a given range of values
// If the value is not provided in range it'll set up the initial provided value.
func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.NodeCPUcores = common.ValidateRange(experimentsDetails.NodeCPUcores)
experimentsDetails.CPULoad = common.ValidateRange(experimentsDetails.CPULoad)
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-drain/lib/node-drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
inject, abort chan os.Signal
)

//PrepareNodeDrain contains the preparation steps before chaos injection
// PrepareNodeDrain contains the preparation steps before chaos injection
func PrepareNodeDrain(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

// inject channel is used to transmit signal notifications.
Expand Down
4 changes: 2 additions & 2 deletions chaoslib/litmus/node-io-stress/lib/node-io-stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ func getContainerArguments(experimentsDetails *experimentTypes.ExperimentDetails
return stressArgs
}

//setChaosTunables will set up a random value within a given range of values
//If the value is not provided in range it'll set up the initial provided value.
// setChaosTunables will set up a random value within a given range of values
// If the value is not provided in range it'll set up the initial provided value.
func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.FilesystemUtilizationBytes = common.ValidateRange(experimentsDetails.FilesystemUtilizationBytes)
experimentsDetails.FilesystemUtilizationPercentage = common.ValidateRange(experimentsDetails.FilesystemUtilizationPercentage)
Expand Down
4 changes: 2 additions & 2 deletions chaoslib/litmus/node-memory-hog/lib/node-memory-hog.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ func createHelperPod(experimentsDetails *experimentTypes.ExperimentDetails, chao
return nil
}

//setChaosTunables will set up a random value within a given range of values
//If the value is not provided in range it'll set up the initial provided value.
// setChaosTunables will set up a random value within a given range of values
// If the value is not provided in range it'll set up the initial provided value.
func setChaosTunables(experimentsDetails *experimentTypes.ExperimentDetails) {
experimentsDetails.MemoryConsumptionMebibytes = common.ValidateRange(experimentsDetails.MemoryConsumptionMebibytes)
experimentsDetails.MemoryConsumptionPercentage = common.ValidateRange(experimentsDetails.MemoryConsumptionPercentage)
Expand Down
2 changes: 1 addition & 1 deletion chaoslib/litmus/node-taint/lib/node-taint.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
inject, abort chan os.Signal
)

//PrepareNodeTaint contains the preparation steps before chaos injection
// PrepareNodeTaint contains the preparation steps before chaos injection
func PrepareNodeTaint(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, resultDetails *types.ResultDetails, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails) error {

// inject channel is used to transmit signal notifications.
Expand Down
Loading
Loading