mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
fix lint errors
Signed-off-by: carlory <baofa.fan@daocloud.io>
This commit is contained in:
parent
8b4eae24ab
commit
aecf3238bf
@ -250,12 +250,12 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
// Change the ownership of files in the initial pod.
|
// Change the ownership of files in the initial pod.
|
||||||
if test.changedRootDirFileOwnership != 0 {
|
if test.changedRootDirFileOwnership != 0 {
|
||||||
ginkgo.By(fmt.Sprintf("Changing the root directory file ownership to %s", strconv.Itoa(test.changedRootDirFileOwnership)))
|
ginkgo.By(fmt.Sprintf("Changing the root directory file ownership to %s", strconv.Itoa(test.changedRootDirFileOwnership)))
|
||||||
storageutils.ChangeFilePathGidInPod(ctx, f, rootDirFilePath, strconv.Itoa(test.changedRootDirFileOwnership), pod)
|
storageutils.ChangeFilePathGIDInPod(ctx, f, rootDirFilePath, strconv.Itoa(test.changedRootDirFileOwnership), pod)
|
||||||
}
|
}
|
||||||
|
|
||||||
if test.changedSubDirFileOwnership != 0 {
|
if test.changedSubDirFileOwnership != 0 {
|
||||||
ginkgo.By(fmt.Sprintf("Changing the sub-directory file ownership to %s", strconv.Itoa(test.changedSubDirFileOwnership)))
|
ginkgo.By(fmt.Sprintf("Changing the sub-directory file ownership to %s", strconv.Itoa(test.changedSubDirFileOwnership)))
|
||||||
storageutils.ChangeFilePathGidInPod(ctx, f, subDirFilePath, strconv.Itoa(test.changedSubDirFileOwnership), pod)
|
storageutils.ChangeFilePathGIDInPod(ctx, f, subDirFilePath, strconv.Itoa(test.changedSubDirFileOwnership), pod)
|
||||||
}
|
}
|
||||||
|
|
||||||
ginkgo.By(fmt.Sprintf("Deleting Pod %s/%s", pod.Namespace, pod.Name))
|
ginkgo.By(fmt.Sprintf("Deleting Pod %s/%s", pod.Namespace, pod.Name))
|
||||||
@ -283,7 +283,7 @@ func createPodAndVerifyContentGid(ctx context.Context, f *framework.Framework, p
|
|||||||
var err error
|
var err error
|
||||||
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
storageutils.VerifyFilePathGidInPod(ctx, f, rootDirFilePath, podFsGroup, pod)
|
storageutils.VerifyFilePathGIDInPod(ctx, f, rootDirFilePath, podFsGroup, pod)
|
||||||
|
|
||||||
cmd = fmt.Sprintf("mkdir %s", subdir)
|
cmd = fmt.Sprintf("mkdir %s", subdir)
|
||||||
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
||||||
@ -291,14 +291,14 @@ func createPodAndVerifyContentGid(ctx context.Context, f *framework.Framework, p
|
|||||||
cmd = fmt.Sprintf("touch %s", subDirFilePath)
|
cmd = fmt.Sprintf("touch %s", subDirFilePath)
|
||||||
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
_, _, err = e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
storageutils.VerifyFilePathGidInPod(ctx, f, subDirFilePath, podFsGroup, pod)
|
storageutils.VerifyFilePathGIDInPod(ctx, f, subDirFilePath, podFsGroup, pod)
|
||||||
return pod
|
return pod
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify existing contents of the volume
|
// Verify existing contents of the volume
|
||||||
ginkgo.By(fmt.Sprintf("Verifying the ownership of root directory file is %s", expectedRootDirFileOwnership))
|
ginkgo.By(fmt.Sprintf("Verifying the ownership of root directory file is %s", expectedRootDirFileOwnership))
|
||||||
storageutils.VerifyFilePathGidInPod(ctx, f, rootDirFilePath, expectedRootDirFileOwnership, pod)
|
storageutils.VerifyFilePathGIDInPod(ctx, f, rootDirFilePath, expectedRootDirFileOwnership, pod)
|
||||||
ginkgo.By(fmt.Sprintf("Verifying the ownership of sub directory file is %s", expectedSubDirFileOwnership))
|
ginkgo.By(fmt.Sprintf("Verifying the ownership of sub directory file is %s", expectedSubDirFileOwnership))
|
||||||
storageutils.VerifyFilePathGidInPod(ctx, f, subDirFilePath, expectedSubDirFileOwnership, pod)
|
storageutils.VerifyFilePathGIDInPod(ctx, f, subDirFilePath, expectedSubDirFileOwnership, pod)
|
||||||
return pod
|
return pod
|
||||||
}
|
}
|
||||||
|
@ -722,23 +722,23 @@ func WaitForGVRFinalizer(ctx context.Context, c dynamic.Interface, gvr schema.Gr
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyFilePathGidInPod verfies expected GID of the target filepath
|
// VerifyFilePathGIDInPod verfies expected GID of the target filepath
|
||||||
func VerifyFilePathGidInPod(ctx context.Context, f *framework.Framework, filePath, expectedGid string, pod *v1.Pod) {
|
func VerifyFilePathGIDInPod(ctx context.Context, f *framework.Framework, filePath, expectedGID string, pod *v1.Pod) {
|
||||||
cmd := fmt.Sprintf("ls -l %s", filePath)
|
cmd := fmt.Sprintf("ls -l %s", filePath)
|
||||||
stdout, stderr, err := e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
stdout, stderr, err := e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.Logf("pod %s/%s exec for cmd %s, stdout: %s, stderr: %s", pod.Namespace, pod.Name, cmd, stdout, stderr)
|
framework.Logf("pod %s/%s exec for cmd %s, stdout: %s, stderr: %s", pod.Namespace, pod.Name, cmd, stdout, stderr)
|
||||||
ll := strings.Fields(stdout)
|
ll := strings.Fields(stdout)
|
||||||
framework.Logf("stdout split: %v, expected gid: %v", ll, expectedGid)
|
framework.Logf("stdout split: %v, expected gid: %v", ll, expectedGID)
|
||||||
gomega.Expect(ll[3]).To(gomega.Equal(expectedGid))
|
gomega.Expect(ll[3]).To(gomega.Equal(expectedGID))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeFilePathGidInPod changes the GID of the target filepath.
|
// ChangeFilePathGIDInPod changes the GID of the target filepath.
|
||||||
func ChangeFilePathGidInPod(ctx context.Context, f *framework.Framework, filePath, targetGid string, pod *v1.Pod) {
|
func ChangeFilePathGIDInPod(ctx context.Context, f *framework.Framework, filePath, targetGID string, pod *v1.Pod) {
|
||||||
cmd := fmt.Sprintf("chgrp %s %s", targetGid, filePath)
|
cmd := fmt.Sprintf("chgrp %s %s", targetGID, filePath)
|
||||||
_, _, err := e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
_, _, err := e2epod.ExecShellInPodWithFullOutput(ctx, f, pod.Name, cmd)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
VerifyFilePathGidInPod(ctx, f, filePath, targetGid, pod)
|
VerifyFilePathGIDInPod(ctx, f, filePath, targetGID, pod)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteStorageClass deletes the passed in StorageClass and catches errors other than "Not Found"
|
// DeleteStorageClass deletes the passed in StorageClass and catches errors other than "Not Found"
|
||||||
|
Loading…
Reference in New Issue
Block a user