Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- [*] skip tests that would fail in Debian-build, closes #76 #78

Merged
merged 1 commit into from
Mar 31, 2020

Conversation

suntong
Copy link
Contributor

@suntong suntong commented Mar 28, 2020

closes #76

@suntong suntong mentioned this pull request Mar 28, 2020
Copy link
Owner

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave comments on what actions fail and require root? Isn't super clear without trying, especially on TestStat. For the Receive some tests use mapping user to os.Getuid() so that's an alternative solution in that case.

@suntong
Copy link
Contributor Author

suntong commented Mar 28, 2020

I'm sorry. Sure, see
https://paste.debian.net/1137019/

=== RUN   TestCopyWithSubDir
    TestCopyWithSubDir: receive_test.go:92: 
                Error Trace:    receive_test.go:92
                Error:          Received unexpected error:
                                error from receiver: error setting metadata for /tmp/dest017874814/sub: failed to lchown /tmp/dest017874814/sub: lchown /tmp/dest017874814/sub: operation not permitted
                                github.com/tonistiigi/fsutil.(*sender).run.func3
                                        /.../src/github.com/tonistiigi/fsutil/send.go:96
                                golang.org/x/sync/errgroup.(*Group).Go.func1

. . . 

=== RUN   TestStat
    TestStat: stat_test.go:29: 
                Error Trace:    stat_test.go:29
                Error:          Not equal: 
                                expected: &types.Stat{Path: "foo",
                                Mode: 0x1a4,
                                Uid: 0x0,
                                Gid: 0x0,
                                Size_: 5,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                                actual  : &types.Stat{Path: "foo",
                                Mode: 0x1a4,
                                Uid: 0x3e8,
                                Gid: 0x3e8,
                                Size_: 5,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,2 @@
                                -(*types.Stat)(&Stat{Path:foo,Mode:420,Uid:0,Gid:0,Size_:5,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                +(*types.Stat)(&Stat{Path:foo,Mode:420,Uid:1000,Gid:1000,Size_:5,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                 
                Test:           TestStat
    TestStat: stat_test.go:35: 
                Error Trace:    stat_test.go:35
                Error:          Not equal: 
                                expected: &types.Stat{Path: "zzz",
                                Mode: 0x800001c0,
                                Uid: 0x0,
                                Gid: 0x0,
                                Size_: 0,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                                actual  : &types.Stat{Path: "zzz",
                                Mode: 0x800001c0,
                                Uid: 0x3e8,
                                Gid: 0x3e8,
                                Size_: 0,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,2 @@
                                -(*types.Stat)(&Stat{Path:zzz,Mode:2147484096,Uid:0,Gid:0,Size_:0,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                +(*types.Stat)(&Stat{Path:zzz,Mode:2147484096,Uid:1000,Gid:1000,Size_:0,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                 
                Test:           TestStat
    TestStat: stat_test.go:41: 
                Error Trace:    stat_test.go:41
                Error:          Not equal: 
                                expected: &types.Stat{Path: "aa",
                                Mode: 0x1a4,
                                Uid: 0x0,
                                Gid: 0x0,
                                Size_: 5,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                                actual  : &types.Stat{Path: "aa",
                                Mode: 0x1a4,
                                Uid: 0x3e8,
                                Gid: 0x3e8,
                                Size_: 5,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,2 @@
                                -(*types.Stat)(&Stat{Path:aa,Mode:420,Uid:0,Gid:0,Size_:5,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                +(*types.Stat)(&Stat{Path:aa,Mode:420,Uid:1000,Gid:1000,Size_:5,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                 
                Test:           TestStat
    TestStat: stat_test.go:47: 
                Error Trace:    stat_test.go:47
                Error:          Not equal: 
                                expected: &types.Stat{Path: "dd",
                                Mode: 0x80001ff,
                                Uid: 0x0,
                                Gid: 0x0,
                                Size_: 6,
                                ModTime: 0,
                                Linkname: "../../",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                                actual  : &types.Stat{Path: "dd",
                                Mode: 0x80001ff,
                                Uid: 0x3e8,
                                Gid: 0x3e8,
                                Size_: 6,
                                ModTime: 0,
                                Linkname: "../../",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,2 @@
                                -(*types.Stat)(&Stat{Path:dd,Mode:134218239,Uid:0,Gid:0,Size_:6,ModTime:0,Linkname:../../,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                +(*types.Stat)(&Stat{Path:dd,Mode:134218239,Uid:1000,Gid:1000,Size_:6,ModTime:0,Linkname:../../,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                 
                Test:           TestStat
    TestStat: stat_test.go:53: 
                Error Trace:    stat_test.go:53
                Error:          Not equal: 
                                expected: &types.Stat{Path: "sock",
                                Mode: 0x1ed,
                                Uid: 0x0,
                                Gid: 0x0,
                                Size_: 0,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                                actual  : &types.Stat{Path: "sock",
                                Mode: 0x1ed,
                                Uid: 0x3e8,
                                Gid: 0x3e8,
                                Size_: 0,
                                ModTime: 0,
                                Linkname: "",
                                Devmajor: 0,
                                Devminor: 0,
                                }
                            
                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,2 +1,2 @@
                                -(*types.Stat)(&Stat{Path:sock,Mode:493,Uid:0,Gid:0,Size_:0,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                +(*types.Stat)(&Stat{Path:sock,Mode:493,Uid:1000,Gid:1000,Size_:0,ModTime:0,Linkname:,Devmajor:0,Devminor:0,Xattrs:map[string][]byte{},})
                                 
                Test:           TestStat
--- FAIL: TestStat (0.00s)

@suntong
Copy link
Contributor Author

suntong commented Mar 28, 2020

I don't know why but I saw the two are failing.
Both would be fine if tested under root. See
https://paste.debian.net/1134965/

Update,

  • TestCopyWithSubDir failed because lchown /tmp/dest017874814/sub: operation not permitted for none-root
  • TestStat failed because the it is expected to be run as root (Uid:0,Gid:0)

As for the alternative solution, please do if you want, as long as you can run go test as none-root. Just that this is the quickest fix to me, as fsutil has already been fully covered by CI in every check-in.

@tonistiigi tonistiigi merged commit f427cf1 into tonistiigi:master Mar 31, 2020
@suntong
Copy link
Contributor Author

suntong commented Apr 2, 2020

Thanks a lot Sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debian packaging
2 participants