mjtrangoni / flexlm_exporter

Prometheus exporter for FLEXlm License Manager information
Apache License 2.0
83 stars 30 forks source link

Force server FQDN to lowercase, for handling windows output gracefully. #89

Closed mjtrangoni closed 1 year ago

mjtrangoni commented 1 year ago

Extend fixture test case as well.

See,

--- FAIL: TestParseLmstatLicenseInfoServer (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x102cb46d4]

goroutine 38 [running]:
testing.tRunner.func1.2({0x102dcd700, 0x10311b520})
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1545 +0x1c8
testing.tRunner.func1()
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1548 +0x360
panic({0x102dcd700?, 0x10311b520?})
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/runtime/panic.go:914 +0x218
github.com/mjtrangoni/flexlm_exporter/collector.parseLmstatLicenseInfoServer({0x140000de300, 0x10, 0x200?})
        /Users/mtrangoni/git/flexlm_exporter.git/collector/lmstat.go:233 +0x1e4
github.com/mjtrangoni/flexlm_exporter/collector.TestParseLmstatLicenseInfoServer(0x140002151e0)
        /Users/mtrangoni/git/flexlm_exporter.git/collector/lmstat_test.go:164 +0x844
testing.tRunner(0x140002151e0, 0x102e45fc0)
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1595 +0xe8
created by testing.(*T).Run in goroutine 1
        /opt/homebrew/Cellar/go/1.21.4/libexec/src/testing/testing.go:1648 +0x33c
FAIL    github.com/mjtrangoni/flexlm_exporter/collector 0.343s

@cloudrck cloud please test this branch, and let know if this solve your issue? #80.

Please also check if you see any uppercase server name label in your metrics. It would indicate that something else needs to be lowered.

Thank you!

github-actions[bot] commented 1 year ago

Coverage Status

coverage: 40.629%. remained the same when pulling 0267673e6b25035100db096a08a597576091a38a on fix-nil-pointer into 328696e01413687f42c9ac871487583cee099077 on main.

cloudrck commented 1 year ago

@mjtrangoni Looks like this, indeed fixed the issue. Thanks for the quick fix