You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: resizefs_linux_test.go
    path of file: ./repos/kubernetes/staging/src/k8s.io/mount-utils
    
    the code of the file until where you have to start completion: //go:build linux
// +build linux

/*
Copyright 2021 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package mount

import (
	"fmt"
	"testing"

	"k8s.io/utils/exec"
	fakeexec "k8s.io/utils/exec/testing"
)

func TestGetFileSystemSize(t *testing.T) {
	cmdOutputSuccessXfs := `
	statfs.f_bsize = 4096
	statfs.f_blocks = 1832448
	statfs.f_bavail = 1822366
	statfs.f_files = 3670016
	statfs.f_ffree = 3670012
	statfs.f_flags = 0x1020
	geom.bsize = 4096
	geom.agcount = 4
	geom.agblocks = 458752
	geom.datablocks = 1835008
	geom.rtblocks = 0
	geom.rtextents = 0
	geom.rtextsize = 1
	geom.sunit = 0
	geom.swidth = 0
	counts.freedata = 1822372
	counts.freertx = 0
	counts.freeino = 61
	counts.allocino = 64
`
	cmdOutputNoDataXfs := `
	statfs.f_bsize = 4096
	statfs.f_blocks = 1832448
	statfs.f_bavail = 1822366
	statfs.f_files = 3670016
	statfs.f_ffree = 3670012
	statfs.f_flags = 0x1020
	geom.agcount = 4
	geom.agblocks = 458752
	geom.rtblocks = 0
	geom.rtextents = 0
	geom.rtextsize = 1
	geom.sunit = 0
	geom.swidth = 0
	counts.freedata = 1822372
	counts.freertx = 0
	counts.freeino = 61
	counts.allocino = 64
`
	cmdOutputSuccessExt4 := `
Filesystem volume name:   cloudimg-rootfs
Last mounted on:          /
Filesystem UUID:          testUUID
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              3840000
Block count:              5242880
Reserved block count:     0
Free blocks:              5514413
Free inodes:              3677492
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      252
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16000
Inode blocks per group:   1000
Flex block group size:    16
Mount count:              2
Maximum mount count:      -1
Check interval:           0 (<none>)
Lifetime writes:          180 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	              256
Required extra isize:     32
Desir
    
func TestNeedResize(t *testing.T) {
	testcases := []struct {
		name            string
		devicePath      string
		deviceMountPath string
		readonly        string
		deviceSize      string
		extSize         string
		cmdOutputFsType string
		expectError     bool
		expectResult    bool
	}{
		{
			name:            "True",
			devicePath:      "/dev/test1",
			deviceMountPath: "/mnt/test1",
			readonly:        "0",
			deviceSize:      "2048",
			cmdOutputFsType: "TYPE=ext3",
			extSize:         "20",
			expectError:     false,
			expectResult:    true,
		},
		{
			name:            "False - needed by size but fs is readonly",
			devicePath:      "/dev/test1",
			deviceMountPath: "/mnt/test1",
			readonly:        "1",
			deviceSize:      "2048",
			cmdOutputFsType: "TYPE=ext3",
			extSize:         "20",
			expectError:     false,
			expectResult:    false,
		},
		{
			name:            "False - Not needed by size",
			devicePath:      "/dev/test1",
			deviceMountPath: "/mnt/test1",
			readonly:        "0",
			deviceSize:      "20",
			cmdOutputFsType: "TYPE=ext3",
			extSize:         "2048",
			expectError:     false,
			expectResult:    false,
		},
		{
			name:            "False - Unsupported fs type",
			devicePath:      "/dev/test1",
			deviceMountPath: "/mnt/test1",
			readonly:        "0",
			deviceSize:      "2048",
			extSize:         "1",
			cmdOutputFsType: "TYPE=ntfs",
			expectError:     true,
			expectResult:    false,
		},
	}

	for _, test := range testcases {
		t.Run(test.name, func(t *testing.T) {
			fcmd := fakeexec.FakeCmd{
				CombinedOutputScript: []fakeexec.FakeAction{
					func() ([]byte, []byte, error) { return []byte(test.readonly), nil, nil },
					func() ([]byte, []byte, error) { return []byte(test.deviceSize), nil, nil },
					func() ([]byte, []byte, error) { return []byte(test.cmdOutputFsType), nil, nil },
					func() ([]byte, []byte, error) {
						return []byte(fmt.Sprintf("block size: %s\nblock count: 1", test.extSize)), nil, nil
					},
				},
			}
			fexec := &fakeexec.FakeExec{
				CommandScript: []fakeexec.FakeCommandAction{
					func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
					func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
					func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
					func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
				},
			}
			resizefs := ResizeFs{exec: fexec}

			needResize, err := resizefs.NeedResize(test.devicePath, test.deviceMountPath)
			if !test.expectError && err != nil {
				t.Fatalf("Expect no error but got %v", err)
			}
			if needResize != test.expectResult {
				t.Fatalf("Expect result is %v but got %v", test.expectResult, needResize)
			}
		})
	}
}