Skip to content

Commit 054ae48

Browse files
committed
more names
1 parent fc8c9db commit 054ae48

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

docs/howto/script_testing.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ a stack, starting agents and services and validating results.
5656
- `add_package_zip [-profile <profile>] [-timeout <duration>] <path_to_zip>`: add assets from a Zip-packaged integration package
5757
- `remove_package_zip [-profile <profile>] [-timeout <duration>] <path_to_zip>`: remove assets for Zip-packaged integration package
5858
- `upgrade_package_latest [-profile <profile>] [-timeout <duration>] [<package_name>]`: upgrade the current package or another named package to the latest version
59-
60-
- data stream commands:
61-
- `add_data_stream [-profile <profile>] [-timeout <duration>] [-policy <policy_name>] <config.yaml> <name_var_label>`: add a data stream policy, setting the environment variable named in the positional argument
62-
- `remove_data_stream [-profile <profile>] [-timeout <duration>] <data_stream_name>`: remove a data stream policy
59+
- `add_package_policy [-profile <profile>] [-timeout <duration>] [-policy <policy_name>] <config.yaml> <name_var_label>`: add a package policy, setting the environment variable named in the positional argument
60+
- `remove_package_policy [-profile <profile>] [-timeout <duration>] <data_stream_name>`: remove a package policy
6361
- `get_docs [-profile <profile>] [-timeout <duration>] [<data_stream>]`: get documents from a data stream
6462

6563
- docker commands:
@@ -125,7 +123,7 @@ add_package -profile ${CONFIG_PROFILES}/${PROFILE}
125123
# Add the data stream.
126124
#
127125
# The configuration for the test is described in test_config.yaml below.
128-
add_data_stream -profile ${CONFIG_PROFILES}/${PROFILE} test_config.yaml DATA_STREAM_NAME
126+
add_package_policy -profile ${CONFIG_PROFILES}/${PROFILE} test_config.yaml DATA_STREAM_NAME
129127
130128
# Start the service.
131129
docker_signal test-hits SIGHUP
@@ -145,17 +143,17 @@ docker_down test-hits
145143
stdout '"total_lines":10'
146144
147145
# Get documents from the data stream.
148-
get_docs -profile ${CONFIG_PROFILES}/default -want 10 -timeout 5m ${DATA_STREAM_NAME}
146+
get_docs -profile ${CONFIG_PROFILES}/${PROFILE} -want 10 -timeout 5m ${DATA_STREAM_NAME}
149147
cp stdout got_docs.json
150148
151149
# Remove the data stream.
152-
remove_data_stream -profile ${CONFIG_PROFILES}/default ${DATA_STREAM_NAME}
150+
remove_package_policy -profile ${CONFIG_PROFILES}/${PROFILE} ${DATA_STREAM_NAME}
153151
154152
# Uninstall the agent.
155-
uninstall_agent -profile ${CONFIG_PROFILES}/default -timeout 1m
153+
uninstall_agent -profile ${CONFIG_PROFILES}/${PROFILE} -timeout 1m
156154
157155
# Remove the package resources.
158-
remove_package -profile ${CONFIG_PROFILES}/default
156+
remove_package -profile ${CONFIG_PROFILES}/${PROFILE}
159157
160158
-- test-hits/docker-compose.yml --
161159
version: '2.3'

internal/testrunner/script/data_stream.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/elastic/elastic-package/internal/testrunner/runners/system"
2424
)
2525

26-
func addDataStream(ts *testscript.TestScript, neg bool, args []string) {
26+
func addPackagePolicy(ts *testscript.TestScript, neg bool, args []string) {
2727
clearStdStreams(ts)
2828

2929
pkgRoot := ts.Getenv("PACKAGE_ROOT")
@@ -58,7 +58,7 @@ func addDataStream(ts *testscript.TestScript, neg bool, args []string) {
5858
timeout := flg.Duration("timeout", 0, "timeout (zero or lower indicates no timeout)")
5959
ts.Check(flg.Parse(args))
6060
if flg.NArg() != 2 {
61-
ts.Fatalf("usage: add_data_stream [-profile <profile>] [-timeout <duration>] [-policy <policy_name>] <config.yaml> <name_var_label>")
61+
ts.Fatalf("usage: add_package_policy [-profile <profile>] [-timeout <duration>] [-policy <policy_name>] <config.yaml> <name_var_label>")
6262
}
6363

6464
cfgPath := ts.MkAbs(flg.Arg(0))
@@ -120,7 +120,7 @@ func addDataStream(ts *testscript.TestScript, neg bool, args []string) {
120120
fmt.Fprintf(ts.Stdout(), "added %s data stream policy templates for %s/%s\n", dsName, pkg, ds)
121121
}
122122

123-
func removeDataStream(ts *testscript.TestScript, neg bool, args []string) {
123+
func removePackagePolicy(ts *testscript.TestScript, neg bool, args []string) {
124124
clearStdStreams(ts)
125125

126126
pkg := ts.Getenv("PACKAGE_NAME")
@@ -146,7 +146,7 @@ func removeDataStream(ts *testscript.TestScript, neg bool, args []string) {
146146
timeout := flg.Duration("timeout", 0, "timeout (zero or lower indicates no timeout)")
147147
ts.Check(flg.Parse(args))
148148
if flg.NArg() != 1 {
149-
ts.Fatalf("usage: remove_data_stream [-profile <profile>] [-timeout <duration>] <data_stream_name>")
149+
ts.Fatalf("usage: remove_package_policy [-profile <profile>] [-timeout <duration>] <data_stream_name>")
150150
}
151151

152152
dsName := flg.Arg(0)

internal/testrunner/script/script.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ func Run(dst io.Writer, cmd *cobra.Command, args []string) error {
204204
"upgrade_package_latest": upgradePackageLatest,
205205
"add_package_zip": addPackageZip,
206206
"remove_package_zip": removePackageZip,
207-
"add_data_stream": addDataStream,
208-
"remove_data_stream": removeDataStream,
207+
"add_package_policy": addPackagePolicy,
208+
"remove_package_policy": removePackagePolicy,
209209
"uninstall_agent": uninstallAgent,
210210
"get_docs": getDocs,
211211
"dump_logs": dumpLogs,

test/packages/other/with_script/data_stream/first/_dev/test/scripts/get_docs_external.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ add_package -profile ${CONFIG_PROFILES}/${PROFILE}
2626
! stderr .
2727

2828
# Add the data stream.
29-
add_data_stream -profile ${CONFIG_PROFILES}/${PROFILE} test_config.yaml DATA_STREAM_NAME
29+
add_package_policy -profile ${CONFIG_PROFILES}/${PROFILE} test_config.yaml DATA_STREAM_NAME
3030
! stderr .
31-
cmpenv stdout want_add_data_stream.text
31+
cmpenv stdout want_add_package_policy.text
3232
exec echo ${DATA_STREAM_NAME}
3333
cp stdout got_data_stream_name.text
3434
match_file want_data_stream_name.pattern got_data_stream_name.text
@@ -66,9 +66,9 @@ upgrade_package_latest -profile ${CONFIG_PROFILES}/${PROFILE}
6666
stdout 'upgraded package '${PACKAGE_NAME}' from version '${CURRENT_VERSION@R}
6767

6868
# Remove the data stream.
69-
remove_data_stream -profile ${CONFIG_PROFILES}/${PROFILE} ${DATA_STREAM_NAME}
69+
remove_package_policy -profile ${CONFIG_PROFILES}/${PROFILE} ${DATA_STREAM_NAME}
7070
! stderr .
71-
cmpenv stdout want_remove_data_stream.text
71+
cmpenv stdout want_remove_package_policy.text
7272

7373
# Uninstall the agent.
7474
uninstall_agent -profile ${CONFIG_PROFILES}/${PROFILE} -timeout 1m
@@ -127,7 +127,7 @@ data_stream:
127127
tcp_port: 9999
128128
-- want_data_stream_name.pattern --
129129
logs-with_script\.first-[0-9]+
130-
-- want_add_data_stream.text --
130+
-- want_add_package_policy.text --
131131
added ${DATA_STREAM_NAME} data stream policy templates for ${PACKAGE_NAME}/${DATA_STREAM}
132-
-- want_remove_data_stream.text --
132+
-- want_remove_package_policy.text --
133133
removed ${DATA_STREAM_NAME} data stream policy templates for ${PACKAGE_NAME}/${DATA_STREAM}

0 commit comments

Comments
 (0)