@@ -22,6 +22,7 @@ import (
2222	"testing" 
2323
2424	"github.com/stretchr/testify/assert" 
25+ 	"github.com/stretchr/testify/require" 
2526
2627	ucfg "github.com/elastic/go-ucfg" 
2728	"github.com/elastic/go-ucfg/parse" 
@@ -47,6 +48,18 @@ func TestResolverWhenTheKeyExist(t *testing.T) {
4748	resolver  :=  ResolverWrap (keystore )
4849	v , pCfg , err  :=  resolver ("output.elasticsearch.password" )
4950	assert .NoError (t , err )
50- 	assert .Equal (t , pCfg , parse .DefaultConfig )
51- 	assert .Equal (t , v , "secret" )
51+ 	require .NoError (t , err )
52+ 	require .Equal (t , pCfg , parseConfig )
53+ 
54+ 	// Regression test for https://github.com/elastic/beats/issues/29789 
55+ 	// Cheat a bit by reproducing part of the go-ucfg dynamic variable resolution process here. The 
56+ 	// config returned by the resolver will be used with a call to the go-ucfg parser. The 
57+ 	// public entrypoint is the ValueWithConfig function below. Make sure the parsed value is 
58+ 	// correct. See https://github.com/elastic/go-ucfg/blob/fc880abbe1f30b653d113da96a4a7e82743c0cc1/types.go#L539 
59+ 	iface , err  :=  parse .ValueWithConfig (v , pCfg )
60+ 	require .NoError (t , err )
61+ 
62+ 	secret , ok  :=  iface .(string )
63+ 	require .True (t , ok , "parsed secret is not a string" )
64+ 	require .Equal (t , string (secretValue ), secret )
5265}
0 commit comments