Add ability to read query from file to postgresql_extensible input (#6361)

This commit is contained in:
Boris Popovschi
2019-09-12 23:38:35 +03:00
committed by Daniel Nelson
parent bae12dde1e
commit d717e8ea03
4 changed files with 66 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ func queryRunner(t *testing.T, q query) *testutil.Accumulator {
}
var acc testutil.Accumulator
p.Start(&acc)
p.Init()
require.NoError(t, acc.GatherError(p.Gather))
return &acc
}
@@ -201,6 +201,31 @@ func TestPostgresqlFieldOutput(t *testing.T) {
}
}
func TestPostgresqlSqlScript(t *testing.T) {
q := query{{
Script: "testdata/test.sql",
Version: 901,
Withdbname: false,
Tagvalue: "",
}}
p := &Postgresql{
Service: postgresql.Service{
Address: fmt.Sprintf(
"host=%s user=postgres sslmode=disable",
testutil.GetLocalHost(),
),
IsPgBouncer: false,
},
Databases: []string{"postgres"},
Query: q,
}
var acc testutil.Accumulator
p.Start(&acc)
p.Init()
require.NoError(t, acc.GatherError(p.Gather))
}
func TestPostgresqlIgnoresUnwantedColumns(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")