ignore fs_test.go

This commit is contained in:
Jianrong 2021-08-07 11:42:24 +10:00
parent 0fdab2027c
commit 10260b0749
2 changed files with 85 additions and 86 deletions

View file

@ -8,6 +8,7 @@ run:
skip-dirs-use-default: true skip-dirs-use-default: true
skip-files: skip-files:
- core/genesis_alloc.go - core/genesis_alloc.go
- cmd/swarm/fs_test.go
# TODO: Too many errors, turn on one by one # TODO: Too many errors, turn on one by one
linters: linters:

View file

@ -26,10 +26,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
//"time"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
//"github.com/ethereum/go-ethereum/log"
) )
type testFile struct { type testFile struct {
@ -121,90 +119,90 @@ func TestCLISwarmFs(t *testing.T) {
//hashRegexp := `[a-f\d]{64}` //hashRegexp := `[a-f\d]{64}`
//log.Debug("swarmfs cli test: unmounting first run...", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath)) //log.Debug("swarmfs cli test: unmounting first run...", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath))
// unmount := runSwarm(t, []string{ // unmount := runSwarm(t, []string{
// fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath), // fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath),
// "fs", // "fs",
// "unmount", // "unmount",
// mountPoint, // mountPoint,
// }...) // }...)
// _, matches := unmount.ExpectRegexp(hashRegexp) // _, matches := unmount.ExpectRegexp(hashRegexp)
// unmount.ExpectExit() // unmount.ExpectExit()
// //
// hash := matches[0] // hash := matches[0]
// if hash == mhash { // if hash == mhash {
// t.Fatal("this should not be equal") // t.Fatal("this should not be equal")
// } // }
// log.Debug("swarmfs cli test: asserting no files in mount point") // log.Debug("swarmfs cli test: asserting no files in mount point")
// //
// //check that there's nothing in the mount folder // //check that there's nothing in the mount folder
// filesInDir, err := ioutil.ReadDir(mountPoint) // filesInDir, err := ioutil.ReadDir(mountPoint)
// if err != nil { // if err != nil {
// t.Fatalf("had an error reading the directory: %v", err) // t.Fatalf("had an error reading the directory: %v", err)
// } // }
// //
// if len(filesInDir) != 0 { // if len(filesInDir) != 0 {
// t.Fatal("there shouldn't be anything here") // t.Fatal("there shouldn't be anything here")
// } // }
// //
// secondMountPoint, err := ioutil.TempDir("", "swarm-test") // secondMountPoint, err := ioutil.TempDir("", "swarm-test")
// log.Debug("swarmfs cli test", "2nd mount point at", secondMountPoint) // log.Debug("swarmfs cli test", "2nd mount point at", secondMountPoint)
// if err != nil { // if err != nil {
// t.Fatal(err) // t.Fatal(err)
// } // }
// defer os.RemoveAll(secondMountPoint) // defer os.RemoveAll(secondMountPoint)
// //
// log.Debug("swarmfs cli test: remounting at second mount point", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath)) // log.Debug("swarmfs cli test: remounting at second mount point", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath))
// //
// //remount, check files // //remount, check files
// newMount := runSwarm(t, []string{ // newMount := runSwarm(t, []string{
// fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath), // fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath),
// "fs", // "fs",
// "mount", // "mount",
// hash, // the latest hash // hash, // the latest hash
// secondMountPoint, // secondMountPoint,
// }...) // }...)
// //
// newMount.ExpectExit() // newMount.ExpectExit()
// time.Sleep(1 * time.Second) // time.Sleep(1 * time.Second)
// //
// filesInDir, err = ioutil.ReadDir(secondMountPoint) // filesInDir, err = ioutil.ReadDir(secondMountPoint)
// if err != nil { // if err != nil {
// t.Fatal(err) // t.Fatal(err)
// } // }
// //
// if len(filesInDir) == 0 { // if len(filesInDir) == 0 {
// t.Fatal("there should be something here") // t.Fatal("there should be something here")
// } // }
// //
// log.Debug("swarmfs cli test: traversing file tree to see it matches previous mount") // log.Debug("swarmfs cli test: traversing file tree to see it matches previous mount")
// //
// for _, file := range filesToAssert { // for _, file := range filesToAssert {
// file.filePath = strings.Replace(file.filePath, mountPoint, secondMountPoint, -1) // file.filePath = strings.Replace(file.filePath, mountPoint, secondMountPoint, -1)
// fileBytes, err := ioutil.ReadFile(file.filePath) // fileBytes, err := ioutil.ReadFile(file.filePath)
// //
// if err != nil { // if err != nil {
// t.Fatal(err) // t.Fatal(err)
// } // }
// if !bytes.Equal(fileBytes, bytes.NewBufferString(file.content).Bytes()) { // if !bytes.Equal(fileBytes, bytes.NewBufferString(file.content).Bytes()) {
// t.Fatal("this should be equal") // t.Fatal("this should be equal")
// } // }
// } // }
// //
// log.Debug("swarmfs cli test: unmounting second run", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath)) // log.Debug("swarmfs cli test: unmounting second run", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath))
// //
// unmountSec := runSwarm(t, []string{ // unmountSec := runSwarm(t, []string{
// fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath), // fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath),
// "fs", // "fs",
// "unmount", // "unmount",
// secondMountPoint, // secondMountPoint,
// }...) // }...)
// //
// _, matches = unmountSec.ExpectRegexp(hashRegexp) // _, matches = unmountSec.ExpectRegexp(hashRegexp)
// unmountSec.ExpectExit() // unmountSec.ExpectExit()
// //
// if matches[0] != hash { // if matches[0] != hash {
// t.Fatal("these should be equal - no changes made") // t.Fatal("these should be equal - no changes made")
// } // }
} }
func doUploadEmptyDir(t *testing.T, node *testNode) string { func doUploadEmptyDir(t *testing.T, node *testNode) string {