Skip to content

Commit

Permalink
Update go version to 1.22 (#191)
Browse files Browse the repository at this point in the history
Signed-off-by: nitesh3108 <nitesh_rewatkar@dell.com>
Co-authored-by: mdutka-dell <115641913+mdutka-dell@users.noreply.github.com>
Co-authored-by: Chiman Jain <chimanjain15@gmail.com>
Co-authored-by: Bartosz Ciesielczyk <120648697+cbartoszDell@users.noreply.github.com>
  • Loading branch information
4 people committed Feb 23, 2024
1 parent e6e6402 commit a238d6a
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 9 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ jobs:
go-version: "1.22"
cache: false
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: Vendor packages
run: |
go mod vendor
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.53
version: v1.56.2
skip-cache: true

malware-security-scan:
name: Malware Scanner
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: Malware Scanner
uses: dell/common-github-actions/malware-scanner@main
with:
Expand All @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: Run the forbidden words scan
uses: dell/common-github-actions/code-sanitizer@main
with:
Expand All @@ -71,7 +71,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: Run Hadolint
uses: hadolint/hadolint-action@v3.1.0

Expand Down Expand Up @@ -105,7 +105,11 @@ jobs:
git config --global url."https://csmbot:$TOKEN@github.com".insteadOf "https://github.com"
echo "machine github.com login csmbot password $TOKEN" >> ~/.netrc
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: Vendor packages
run: |
go mod vendor
Expand Down Expand Up @@ -136,7 +140,7 @@ jobs:
go-version: "1.22"
cache: false
- name: Checkout the code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: "Vendor packages"
run: |
go mod vendor
Expand Down
4 changes: 4 additions & 0 deletions csm-common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Common base image for all CSM images. When base image is upgraded, update the following 3 lines with URL, Version, and DEFAULT_BASEIMAGE variable.
# URL: https://catalog.redhat.com/software/containers/ubi9/ubi-micro/615bdf943f6014fa45ae1b58?architecture=amd64&image=65425acee668a4a85da08f2e
# Version: ubi9/ubi-micro 9.3-6
DEFAULT_BASEIMAGE="registry.access.redhat.com/ubi9/ubi-micro@sha256:b7d8fd2840e92e8adc68414e13d859763ef33c3d4c4e27f910e939c00d642c29"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/dell/cosi

go 1.21
go 1.22

require (
github.com/aws/aws-sdk-go v1.45.1
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func TestNew(t *testing.T) {

testFile, err := tc.file.Write()
defer os.RemoveAll(path.Dir(testFile))

if err != nil {
// unexpected error, should panic
panic(err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/internal/transport/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,12 @@ func TestNew(t *testing.T) {
if assert.Error(t, err) {
assert.Regexp(t, tc.errorMessage, err.Error())
}

return
}

assert.NoError(t, err)

if assert.NotNil(t, transport) &&
assert.NotNil(t, transport.TLSClientConfig) {
assert.Equal(t, tc.config.Insecure, transport.TLSClientConfig.InsecureSkipVerify)
Expand Down
6 changes: 6 additions & 0 deletions pkg/provisioner/driverset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ func TestDriversetAdd(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

err := tc.driverset.Add(tc.driver)
if err != nil {
assert.ErrorContains(t, err, tc.wantErrorMsg)
}

compareSyncMaps(t, &tc.want.drivers, &tc.driverset.drivers)
})
}
Expand Down Expand Up @@ -126,10 +128,12 @@ func TestDriversetGet(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

got, err := tc.driverset.Get(tc.id)
if err != nil {
assert.ErrorContains(t, err, tc.wantErrorMsg)
}

assert.Equal(t, tc.want, got)
})
}
Expand All @@ -154,6 +158,7 @@ func TestErrDriverDuplicate(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

err := ErrDriverDuplicate{tc.id}
assert.Equal(t, err.Error(), tc.want)
})
Expand All @@ -179,6 +184,7 @@ func TestErrNotConfigured(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

err := ErrNotConfigured{tc.id}
assert.Equal(t, err.Error(), tc.want)
})
Expand Down
1 change: 1 addition & 0 deletions pkg/provisioner/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestExactlyOne(t *testing.T) {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

actual := exactlyOne(tc.nillables...)
assert.Equal(t, tc.expected, actual)
})
Expand Down
4 changes: 4 additions & 0 deletions pkg/provisioner/objectscale/objectscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ func testDriverNew(t *testing.T) {
defer cancel()

driver, err := New(tc.config)

switch tc.result {
case ok:
assert.NoError(t, err)

if assert.NotNil(t, driver) {
assert.Equal(t, tc.config.Id, driver.ID())
}

case warning:
assert.NoError(t, err)

if assert.NotNil(t, driver) {
assert.Equal(t, strings.ReplaceAll(tc.config.Id, "-", "_"), driver.ID())
}
Expand Down Expand Up @@ -262,6 +265,7 @@ func testParsePolicyStatement(t *testing.T) {
t.Run(scenario.description, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

updatedPolicy := parsePolicyStatement(ctx, scenario.inputStatements, scenario.awsBucketResourceARN, scenario.awsPrincipalString)
assert.Equalf(t, scenario.expectedOutput, updatedPolicy, "not equal")
})
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/steps/bucket_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func CheckBucketAccessStatus(ctx context.Context, bucketClient *bucketclientset.

err := retry(ctx, attempts, sleep, func() error {
var err error

myBucketAccess, err = bucketClient.ObjectstorageV1alpha1().BucketAccesses(bucketAccess.Namespace).Get(ctx, bucketAccess.Name, v1.GetOptions{})
if err != nil {
return err
Expand All @@ -115,6 +116,7 @@ func CheckBucketAccessStatus(ctx context.Context, bucketClient *bucketclientset.
if !myBucketAccess.Status.AccessGranted {
return fmt.Errorf("AccessGranted is false")
}

return nil
})

Expand All @@ -139,6 +141,7 @@ func GetBucketResource(ctx context.Context, bucketClient *bucketclientset.Client

err := retry(ctx, attempts, sleep, func() error {
var err error

myBucketClaim, err = bucketClient.ObjectstorageV1alpha1().BucketClaims(bucketClaim.Namespace).Get(ctx, bucketClaim.Name, v1.GetOptions{})
if err != nil {
return err
Expand All @@ -147,6 +150,7 @@ func GetBucketResource(ctx context.Context, bucketClient *bucketclientset.Client
if myBucketClaim.Status.BucketName == "" && myBucketClaim.Spec.ExistingBucketName == "" {
return fmt.Errorf("BucketName and ExistingBucketName are empty")
}

return nil
})

Expand All @@ -156,6 +160,7 @@ func GetBucketResource(ctx context.Context, bucketClient *bucketclientset.Client

err = retry(ctx, attempts, sleep, func() error {
var err error

name := ""
if myBucketClaim.Spec.ExistingBucketName != "" {
name = myBucketClaim.Spec.ExistingBucketName
Expand Down Expand Up @@ -192,6 +197,7 @@ func CheckBucketStatusEmpty(ctx context.Context, bucketClient *bucketclientset.C
err := retry(ctx, attempts, sleep, func() error {
var err error
myBucketClaim, err = bucketClient.ObjectstorageV1alpha1().BucketClaims(bucketClaim.Namespace).Get(ctx, bucketClaim.Name, v1.GetOptions{})

return err
})

Expand Down
1 change: 1 addition & 0 deletions tests/integration/steps/kubernetes_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func CheckSecret(ctx context.Context, clientset *kubernetes.Clientset, inputSecr

err := retry(ctx, attempts, sleep, func() error {
var err error

k8sSecret, err = clientset.CoreV1().Secrets(inputSecret.Namespace).Get(ctx, inputSecret.Name, metav1.GetOptions{})
if err != nil {
return err
Expand Down

0 comments on commit a238d6a

Please sign in to comment.