Skip to content

kitgen: tests fail on Windows #740

@ChrisHines

Description

@ChrisHines

A quick peek at what the first failing test is doing reveals it is relying on *nix style tools and not checking error returns. https://github.com/go-kit/kit/blob/master/cmd/kitgen/main_test.go#L66

diffCmd := exec.Command("diff", outpath, errfile.Name())
diffOut, _ := diffCmd.Output()
t.Log(string(diffOut))
t.Errorf("Processing output didn't match %q. Results recorded in %q.", outpath, errfile.Name())

I didn't dig any deeper.

Full test output below.

C:\Users\Chris\Go\src\github.com\go-kit\kit>go version
go version go1.10.3 windows/amd64

C:\Users\Chris\Go\src\github.com\go-kit\kit>go test ./cmd/kitgen
--- FAIL: TestProcess (0.13s)
    --- FAIL: TestProcess/anonfields (0.02s)
        --- FAIL: TestProcess/anonfields/flat (0.02s)
                main_test.go:68:
                main_test.go:69: Processing output didn't match "testdata\\anonfields\\flat\\gokit.go". Results recorded in "C:\\Users\\Chris\\AppData\\Local\\Temp\\flatgokit.go605583031".
        --- FAIL: TestProcess/anonfields/default (0.00s)
                main_test.go:28: testdata\anonfields\in.go endpoints/endpoints.go:9:20: unknown escape sequence (and 5 more errors)
                        formatNodes
                        github.com/go-kit/kit/cmd/kitgen.formatNodes
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/transform.go:153
                        github.com/go-kit/kit/cmd/kitgen.deflayout.transformAST
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/deflayout.go:62
                        github.com/go-kit/kit/cmd/kitgen.(*deflayout).transformAST
                                <autogenerated>:1
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:102
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
                        generating AST
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:104
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
    --- FAIL: TestProcess/foo (0.02s)
        --- FAIL: TestProcess/foo/flat (0.02s)
                main_test.go:68:
                main_test.go:69: Processing output didn't match "testdata\\foo\\flat\\gokit.go". Results recorded in "C:\\Users\\Chris\\AppData\\Local\\Temp\\flatgokit.go133078698".
        --- FAIL: TestProcess/foo/default (0.00s)
                main_test.go:28: testdata\foo\in.go http/http.go:9:20: unknown escape sequence (and 5 more errors)
                        formatNodes
                        github.com/go-kit/kit/cmd/kitgen.formatNodes
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/transform.go:153
                        github.com/go-kit/kit/cmd/kitgen.deflayout.transformAST
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/deflayout.go:62
                        github.com/go-kit/kit/cmd/kitgen.(*deflayout).transformAST
                                <autogenerated>:1
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:102
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
                        generating AST
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:104
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
    --- FAIL: TestProcess/profilesvc (0.04s)
        --- FAIL: TestProcess/profilesvc/flat (0.03s)
                main_test.go:68:
                main_test.go:69: Processing output didn't match "testdata\\profilesvc\\flat\\gokit.go". Results recorded in "C:\\Users\\Chris\\AppData\\Local\\Temp\\flatgokit.go729902081".
        --- FAIL: TestProcess/profilesvc/default (0.01s)
                main_test.go:28: testdata\profilesvc\in.go endpoints/endpoints.go:9:20: unknown escape sequence (and 6 more errors)
                        formatNodes
                        github.com/go-kit/kit/cmd/kitgen.formatNodes
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/transform.go:153
                        github.com/go-kit/kit/cmd/kitgen.deflayout.transformAST
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/deflayout.go:62
                        github.com/go-kit/kit/cmd/kitgen.(*deflayout).transformAST
                                <autogenerated>:1
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:102
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
                        generating AST
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:104
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
    --- FAIL: TestProcess/stringservice (0.02s)
        --- FAIL: TestProcess/stringservice/flat (0.02s)
                main_test.go:68:
                main_test.go:69: Processing output didn't match "testdata\\stringservice\\flat\\gokit.go". Results recorded in "C:\\Users\\Chris\\AppData\\Local\\Temp\\flatgokit.go775458668".
        --- FAIL: TestProcess/stringservice/default (0.00s)
                main_test.go:28: testdata\stringservice\in.go endpoints/endpoints.go:9:20: unknown escape sequence (and 6 more errors)
                        formatNodes
                        github.com/go-kit/kit/cmd/kitgen.formatNodes
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/transform.go:153
                        github.com/go-kit/kit/cmd/kitgen.deflayout.transformAST
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/deflayout.go:62
                        github.com/go-kit/kit/cmd/kitgen.(*deflayout).transformAST
                                <autogenerated>:1
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:102
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
                        generating AST
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:104
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
    --- FAIL: TestProcess/underscores (0.02s)
        --- FAIL: TestProcess/underscores/flat (0.02s)
                main_test.go:68:
                main_test.go:69: Processing output didn't match "testdata\\underscores\\flat\\gokit.go". Results recorded in "C:\\Users\\Chris\\AppData\\Local\\Temp\\flatgokit.go371323355".
        --- FAIL: TestProcess/underscores/default (0.00s)
                main_test.go:28: testdata\underscores\in.go endpoints/endpoints.go:9:20: unknown escape sequence (and 6 more errors)
                        formatNodes
                        github.com/go-kit/kit/cmd/kitgen.formatNodes
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/transform.go:153
                        github.com/go-kit/kit/cmd/kitgen.deflayout.transformAST
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/deflayout.go:62
                        github.com/go-kit/kit/cmd/kitgen.(*deflayout).transformAST
                                <autogenerated>:1
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:102
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
                        generating AST
                        github.com/go-kit/kit/cmd/kitgen.process
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main.go:104
                        github.com/go-kit/kit/cmd/kitgen.TestProcess.func1.1
                                C:/Users/Chris/Go/src/github.com/go-kit/kit/cmd/kitgen/main_test.go:26
                        testing.tRunner
                                C:/Go/src/testing/testing.go:777
                        runtime.goexit
                                C:/Go/src/runtime/asm_amd64.s:2361
--- FAIL: TestImportPath (0.00s)
    --- FAIL: TestImportPath/"/gopath/"_+_"/gopath/src/somewhere" (0.00s)
        path_test.go:14: Expected no error, got "\"/gopath/src/somewhere\" is not an absolute path"
    --- FAIL: TestImportPath/"/gopath"_+_"/gopath/src/somewhere" (0.00s)
        path_test.go:14: Expected no error, got "\"/gopath/src/somewhere\" is not an absolute path"
    --- FAIL: TestImportPath/"/gopath:/other"_+_"/gopath/src/somewhere" (0.00s)
        path_test.go:14: Expected no error, got "\"/gopath/src/somewhere\" is not an absolute path"
    --- FAIL: TestImportPath/"/other:/gopath/"_+_"/gopath/src/somewhere" (0.00s)
        path_test.go:14: Expected no error, got "\"/gopath/src/somewhere\" is not an absolute path"
--- FAIL: TestImportPathSadpath (0.00s)
    --- FAIL: TestImportPathSadpath/""_+_"/gopath/src/somewhere" (0.00s)
        path_test.go:36: Expected "\"/gopath/src/somewhere\" is not an absolute path" to include "is not in"
FAIL
FAIL    github.com/go-kit/kit/cmd/kitgen        0.635s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions