mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
``` git ls-files \*.js \*.go \ | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n' git ls-files \*.vue \ | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n' ```
47 lines
988 B
Go
47 lines
988 B
Go
// SPDX-FileCopyrightText: 2022 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package flow
|
|
|
|
import (
|
|
"path"
|
|
"runtime"
|
|
"testing"
|
|
"time"
|
|
|
|
"akvorado/common/reporter"
|
|
"akvorado/inlet/flow/input/file"
|
|
)
|
|
|
|
func TestFlow(t *testing.T) {
|
|
r := reporter.NewMock(t)
|
|
_, src, _, _ := runtime.Caller(0)
|
|
base := path.Join(path.Dir(src), "decoder", "netflow", "testdata")
|
|
config := DefaultConfiguration()
|
|
config.Inputs = []InputConfiguration{
|
|
{
|
|
Decoder: "netflow",
|
|
Config: &file.Configuration{
|
|
Paths: []string{
|
|
path.Join(base, "options-template-257.data"),
|
|
path.Join(base, "options-data-257.data"),
|
|
path.Join(base, "template-260.data"),
|
|
path.Join(base, "data-260.data"),
|
|
},
|
|
},
|
|
},
|
|
}
|
|
c := NewMock(t, r, config)
|
|
|
|
// Receive flows
|
|
received := []*Message{}
|
|
for i := 0; i < 10; i++ {
|
|
select {
|
|
case flow := <-c.Flows():
|
|
received = append(received, flow)
|
|
case <-time.After(30 * time.Millisecond):
|
|
t.Fatalf("no flow received")
|
|
}
|
|
}
|
|
}
|