Last active
May 13, 2022 15:36
-
-
Save madflojo/f70c8d6dd0962002e31396825d5b7bad to your computer and use it in GitHub Desktop.
Go Project Structure - Testing App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestRunningServer(t *testing.T) { | |
cfg := viper.New() | |
cfg.Set("disable_logging", true) | |
cfg.Set("listen_addr", "localhost:9000") | |
cfg.Set("kvstore_type", "redis") | |
cfg.Set("redis_server", "redis:6379") | |
cfg.Set("enable_kvstore", true) | |
cfg.Set("debug", true) | |
cfg.Set("trace", true) | |
go func() { | |
err := Run(cfg) | |
if err != nil && err != ErrShutdown { | |
t.Errorf("Run unexpectedly stopped - %s", err) | |
} | |
}() | |
// Clean up | |
defer Stop() | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment