Skip to content

Commit

Permalink
add test that was creating a panic
Browse files Browse the repository at this point in the history
  • Loading branch information
wildum committed Apr 2, 2024
1 parent b40e3df commit a3a532c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions internal/flow/testdata/import_file/import_file_17.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
This is a simple test with several levels of nesting.
This test would often panic when re-evaluation could run concurrently with a config reload.
Now that it is protected with mutex, this test should always pass.

-- main.river --
import.file "a_namespace" {
filename = "module.river"
}

a_namespace.a "default" {
a_argument = 47
}

testcomponents.summation "sum" {
input = 10
}

-- module.river --
declare "a" {
import.file "b_namespace" {
filename = "nested_module.river"
}

argument "a_argument" {
comment = "Where to send collected metrics."
}

b_namespace.b "default" {
b_argument = 147
}

export "a_export" {
value = argument.a_argument.value + b_namespace.b.default.b_export + 1
}
}

-- nested_module.river --
declare "b" {
import.file "c_namespace" {
filename = "other_nested_module.river"
}

argument "b_argument" {
optional = false
}

c_namespace.c "default" {
c_argument = 101
}

export "b_export" {
value = argument.b_argument.value + c_namespace.c.default.c_export + 1
}
}

-- other_nested_module.river --
declare "c" {
argument "c_argument" {
optional = false
}

export "c_export" {
value = argument.c_argument.value + 1
}
}

0 comments on commit a3a532c

Please sign in to comment.