lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Tests failing

Open tuxpeople opened this issue 5 years ago • 9 comments

I'm currently working on packaging lazydocker for Alpine Linux.

Describe the bug go test fails:

# github.com/jesseduffield/lazygit/pkg/gui
 pkg/gui/keybindings.go:178:9: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

To Reproduce Steps to reproduce the behavior:

  1. GOPATH="$srcdir" go build
  2. GOPATH="$srcdir" go test ./...

$srcdir is where the extracted tar.gz is.

Expected behaviour Tests succeeding

Desktop (please complete the following information):

  • OS: Alpine
  • Lazygit Version v0.22.8

In the meantime, I'll deactivate the tests.

tuxpeople avatar Sep 21 '20 12:09 tuxpeople

@tuxpeople can you give https://github.com/jesseduffield/lazygit/pull/1011 a go?

jesseduffield avatar Sep 23 '20 09:09 jesseduffield

I did:

dev@alpine-pkgdev: ~$ cd test/
dev@alpine-pkgdev: ~/test$ git clone https://github.com/jesseduffield/lazygit.git
Cloning into 'lazygit'...
remote: Enumerating objects: 79, done.
remote: Counting objects: 100% (79/79), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 17871 (delta 46), reused 44 (delta 25), pack-reused 17792
Receiving objects: 100% (17871/17871), 17.86 MiB | 8.01 MiB/s, done.
Resolving deltas: 100% (12108/12108), done.
Updating files: 100% (1398/1398), done.
dev@alpine-pkgdev: ~/test$ cd lazygit
dev@alpine-pkgdev: ~/test/lazygit$ git checkout 1009_string-conversion
Branch '1009_string-conversion' set up to track remote branch '1009_string-conversion' from 'origin'.
Switched to a new branch '1009_string-conversion'
dev@alpine-pkgdev: ~/test/lazygit$ sudo apk add go
(1/1) Installing go (1.13.14-r0)
Executing busybox-1.31.1-r19.trigger
OK: 565 MiB in 74 packages

First attempt:

dev@alpine-pkgdev: ~/test/lazygit$ go build
# github.com/jesseduffield/lazygit/pkg/gui
pkg/gui/keybindings.go:6:2: imported and not used: "strconv"
note: module requires Go 1.14

The most recent version of go in Alpine 3.12 is 1.13.14. However, There is a more recent version of it in the "Edge" channel: 1.15.2:

dev@alpine-pkgdev: ~/test/lazygit$ sudo apk del go
(1/1) Purging go (1.13.14-r0)
Executing busybox-1.31.1-r19.trigger
OK: 263 MiB in 73 packages
dev@alpine-pkgdev: ~/test/lazygit$ sudo apk add go --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/1) Installing go (1.15.2-r0)
Executing busybox-1.31.1-r19.trigger
OK: 572 MiB in 74 packages

Second attempt:

dev@alpine-pkgdev: ~/test/lazygit$ go build
# github.com/jesseduffield/lazygit/pkg/gui
pkg/gui/keybindings.go:6:2: imported and not used: "strconv"
dev@alpine-pkgdev: ~/test/lazygit$ go test ./...
# github.com/jesseduffield/lazygit/pkg/gui
pkg/gui/keybindings.go:6:2: imported and not used: "strconv"
FAIL	github.com/jesseduffield/lazygit/pkg/app [build failed]
ok  	github.com/jesseduffield/lazygit/pkg/commands	0.352s
ok  	github.com/jesseduffield/lazygit/pkg/commands/patch	(cached)
ok  	github.com/jesseduffield/lazygit/pkg/gui/boxlayout	(cached)
ok  	github.com/jesseduffield/lazygit/pkg/i18n	(cached)
ok  	github.com/jesseduffield/lazygit/pkg/utils	(cached)

tuxpeople avatar Sep 24 '20 07:09 tuxpeople

@tuxpeople looks like the only error there is about the unnecessary strconv import. That's now been fixed on master, could you retry?

jesseduffield avatar Sep 26 '20 01:09 jesseduffield

@jesseduffield looks good for me now:

dev@alpine-pkgdev: ~/test/lazygit$ go build
dev@alpine-pkgdev: ~/test/lazygit$ go test ./...
?   	github.com/jesseduffield/lazygit	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/app	0.008s
ok  	github.com/jesseduffield/lazygit/pkg/commands	0.540s
?   	github.com/jesseduffield/lazygit/pkg/commands/models	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/commands/oscommands	0.050s
ok  	github.com/jesseduffield/lazygit/pkg/commands/patch	0.009s
?   	github.com/jesseduffield/lazygit/pkg/config	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/env	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/gui	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/gui/boxlayout	0.009s
?   	github.com/jesseduffield/lazygit/pkg/gui/presentation	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/i18n	0.014s
?   	github.com/jesseduffield/lazygit/pkg/tasks	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/test	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/theme	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/updates	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/utils	0.010s
?   	github.com/jesseduffield/lazygit/scripts	[no test files]
?   	github.com/jesseduffield/lazygit/scripts/push_new_patch	[no test files]
dev@alpine-pkgdev: ~/test/lazygit$ echo $?
0

However, I've no idea what Alpines build system will say :-P

I'll update the package in Alpine as soon as you released a new version. But there is still the issue with the go version in Alpine. As I'm relatively new to Alpine, I can't say how this kind of stuff works, but I assume "edge" will eventually end up in beeing the next release of Alpine. I'll test and see what I can do, maybe your new release and the go 1.15.x package will end up at the same Alpine version, so everything is fine.

tuxpeople avatar Sep 30 '20 06:09 tuxpeople

I've released version v0.23.1 now @tuxpeople if you want to give it another go

jesseduffield avatar Oct 10 '20 02:10 jesseduffield

@jesseduffield sorry for the delay.

I tried it with 0.23.2:

71 >>> lazygit: Unpacking /var/cache/distfiles/lazygit-0.23.2.tar.gz...
72 ?   	github.com/jesseduffield/lazygit	[no test files]
73 ok  	github.com/jesseduffield/lazygit/pkg/app	0.010s
74 ok  	github.com/jesseduffield/lazygit/pkg/commands	0.124s
75 ?   	github.com/jesseduffield/lazygit/pkg/commands/models	[no test files]
76 ok  	github.com/jesseduffield/lazygit/pkg/commands/oscommands	0.015s
77 ok  	github.com/jesseduffield/lazygit/pkg/commands/patch	0.007s
78 ?   	github.com/jesseduffield/lazygit/pkg/config	[no test files]
79 ?   	github.com/jesseduffield/lazygit/pkg/env	[no test files]
80 --- FAIL: Test (0.01s)
81     gui_test.go:172: 
82         	Error Trace:	gui_test.go:172
83         	Error:      	Received unexpected error:
84         	            	package .: no Go files in /builds/tuxpeople/aports
85         	Test:       	Test
86 FAIL
87 FAIL	github.com/jesseduffield/lazygit/pkg/gui	0.018s
88 ok  	github.com/jesseduffield/lazygit/pkg/gui/boxlayout	0.007s
89 ?   	github.com/jesseduffield/lazygit/pkg/gui/presentation	[no test files]
90 ok  	github.com/jesseduffield/lazygit/pkg/i18n	0.006s
91 ?   	github.com/jesseduffield/lazygit/pkg/tasks	[no test files]
92 ?   	github.com/jesseduffield/lazygit/pkg/test	[no test files]
93 ?   	github.com/jesseduffield/lazygit/pkg/theme	[no test files]
94 ?   	github.com/jesseduffield/lazygit/pkg/updates	[no test files]
95 ok  	github.com/jesseduffield/lazygit/pkg/utils	0.008s
96 ?   	github.com/jesseduffield/lazygit/scripts	[no test files]
97 ?   	github.com/jesseduffield/lazygit/scripts/push_new_patch	[no test files]
98 FAIL

tuxpeople avatar Oct 13 '20 18:10 tuxpeople

@tuxpeople looks like that test has failed to find the root directory (it assumes /builds/tuxpeople/aports is the one). What directory would be the lazygit root directory? I.e. the one with the 'main.go' file in it? That test is attempting to compile lazygit for the sake of running it in integration tests

jesseduffield avatar Oct 13 '20 22:10 jesseduffield

@jesseduffield I tried again with 0.23.6 and a newer go version (I forgot the go-problem from further above). And last, but not least, locally and not on their build sytem:

dev@alpine-pkgdev: ~/test/lazygit-0.23.6$ go build
dev@alpine-pkgdev: ~/test/lazygit-0.23.6$ go test ./...
?   	github.com/jesseduffield/lazygit	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/app	0.012s
ok  	github.com/jesseduffield/lazygit/pkg/commands	0.325s
?   	github.com/jesseduffield/lazygit/pkg/commands/models	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/commands/oscommands	0.092s
ok  	github.com/jesseduffield/lazygit/pkg/commands/patch	0.006s
?   	github.com/jesseduffield/lazygit/pkg/config	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/env	[no test files]
--- FAIL: Test (0.00s)
panic: must run in lazygit folder or child folder [recovered]
	panic: must run in lazygit folder or child folder

goroutine 19 [running]:
testing.tRunner.func1.1(0x840480, 0x955e40)
	/usr/lib/go/src/testing/testing.go:1076 +0x30d
testing.tRunner.func1(0xc000086900)
	/usr/lib/go/src/testing/testing.go:1079 +0x41a
panic(0x840480, 0x955e40)
	/usr/lib/go/src/runtime/panic.go:969 +0x175
github.com/jesseduffield/lazygit/pkg/gui.getRootDirectory(0xa27890, 0xa278f0)
	/home/dev/test/lazygit-0.23.6/pkg/gui/gui_test.go:282 +0x195
github.com/jesseduffield/lazygit/pkg/gui.Test(0xc000086900)
	/home/dev/test/lazygit-0.23.6/pkg/gui/gui_test.go:164 +0x37
testing.tRunner(0xc000086900, 0x8fc718)
	/usr/lib/go/src/testing/testing.go:1127 +0xef
created by testing.(*T).Run
	/usr/lib/go/src/testing/testing.go:1178 +0x386
FAIL	github.com/jesseduffield/lazygit/pkg/gui	0.010s
ok  	github.com/jesseduffield/lazygit/pkg/gui/boxlayout	0.023s
?   	github.com/jesseduffield/lazygit/pkg/gui/presentation	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/i18n	0.011s
?   	github.com/jesseduffield/lazygit/pkg/tasks	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/test	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/theme	[no test files]
?   	github.com/jesseduffield/lazygit/pkg/updates	[no test files]
ok  	github.com/jesseduffield/lazygit/pkg/utils	0.016s
?   	github.com/jesseduffield/lazygit/scripts	[no test files]
?   	github.com/jesseduffield/lazygit/scripts/push_new_patch	[no test files]
FAIL

tuxpeople avatar Oct 15 '20 07:10 tuxpeople

Is this still an issue?

mark2185 avatar Aug 07 '22 20:08 mark2185