Commit Graph

11 Commits

Author SHA1 Message Date
Eng Zer Jun deede3ecd4
test: use `T.TempDir` to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-18 16:57:41 +08:00
Ciprian Hacman ea7df00719 Run hack/update-gofmt.sh 2021-12-01 22:39:50 +02:00
Eng Zer Jun 425173ae9f
refactor: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-11-12 15:37:18 +08:00
Ciprian Hacman 19564888f4 Use "//go:build" lines together with "// +build" lines
The go command now understands //go:build lines and prefers them over // +build lines. The new syntax uses boolean expressions, just like Go, and should be less error-prone. As of this release, the new syntax is fully supported, and all Go files should be updated to have both forms with the same meaning. To aid in migration, gofmt now automatically synchronizes the two forms. For more details on the syntax and migration plan, see https://golang.org/design/draft-gobuild.
2021-09-20 07:35:31 +03:00
Justin SB 4ca45411d1 nodeup file: Set owner & group when we write the file.
Otherwise we had an issue where the file existed with the correct
owner/group; when we rewrote it we set the owner/group to root/root;
but we then didn't set the owner/group if they were previously
correct.

Was visible in the flatcar test results.
2021-02-07 17:41:13 -05:00
Ciprian Hacman 7fcabc107d Exclude file tests for Windows 2020-08-11 14:28:37 +03:00
Justin SB 00b70dc83a File permission test: clear umask before testing
If the umask isn't 022, directories may not be created in mode 0755,
even if we ask them to be created as such.

umask problems seem unlikely to affect real world usage (negatively)
2020-07-13 12:18:29 -04:00
Zhou Hao d6695b822f Add err judgment to os.RemoveAll
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-07-09 16:48:35 +08:00
Zhou Hao 34931ed930 Add err judgment to ioutil.TempDir
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-07-09 16:45:12 +08:00
Li Zhijian 1608483a5b cleanup tempfiles for files_test
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
2020-07-02 10:33:07 +08:00
Dao Cong Tien de779c2b2f Add UT for upup/pkg/fi/files.go
Signed-off-by: Dao Cong Tien <tiendc@vn.fujitsu.com>
2020-03-20 13:12:30 +07:00