MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestHTTPOutput

Function TestHTTPOutput

pkg/config/output_test.go:55–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestHTTPOutput(t *testing.T) {
56 c := NewWithOpts(WithRun())
57
58 err := c.flags.Parse([]string{"--config-file=_fixtures/http-output.yml"})
59 require.NoError(t, c.viper.BindPFlags(c.flags))
60 require.NoError(t, err)
61 require.NoError(t, c.TryLoadFile(c.GetConfigFile()))
62
63 require.NoError(t, c.Init())
64
65 require.NotNil(t, c.Output)
66 require.IsType(t, http.Config{}, c.Output.Output)
67
68 httpConfig := c.Output.Output.(http.Config)
69 assert.True(t, httpConfig.Enabled)
70 assert.Len(t, httpConfig.Endpoints, 2)
71 assert.Contains(t, httpConfig.Endpoints, "http://localhost:8081")
72 assert.Equal(t, time.Second*2, httpConfig.Timeout)
73 assert.Equal(t, "http://192.168.1.8:3123", httpConfig.ProxyURL)
74 assert.Equal(t, "bunny", httpConfig.ProxyUsername)
75 assert.Equal(t, "bunny", httpConfig.ProxyPassword)
76 assert.True(t, httpConfig.EnableGzip)
77 assert.Equal(t, "basic", httpConfig.Username)
78 assert.Equal(t, "basic", httpConfig.Password)
79 assert.Len(t, httpConfig.Headers, 2)
80 assert.Equal(t, "kkvvkk", httpConfig.Headers["api-key"])
81}
82
83func TestEventlogOutput(t *testing.T) {
84 c := NewWithOpts(WithRun())

Callers

nothing calls this directly

Calls 8

NewWithOptsFunction · 0.85
WithRunFunction · 0.85
TryLoadFileMethod · 0.80
GetConfigFileMethod · 0.80
ContainsMethod · 0.80
EqualMethod · 0.80
InitMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected