Skip to content

Commit e4e22e5

Browse files
RishabhKarnnitisht
authored andcommitted
Added getStreamSchema and DeleteSTream in smoke test
1 parent ea69030 commit e4e22e5

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

tests/main.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ endpoint=$2
2121

2222
run_smoke_test () {
2323
echo "Executing smoke test"
24-
stream_name=$(echo $RANDOM | md5sum | head -c 20)
25-
./testcases/smoke_test.sh "$endpoint" "$stream_name"
24+
#stream_name=$(echo $RANDOM | md5sum | head -c 20)
25+
#./testcases/smoke_test.sh "$endpoint" "$stream_name"
26+
./testcases/smoke_test.sh "$endpoint" "testapistream02"
2627
return $?
2728
}
2829

tests/testcases/smoke_test.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ list_log_streams () {
9292
return 0
9393
}
9494

95+
# Get Stream's schema and [TODO] validate its schema
96+
get_streams_schema () {
97+
echo "Getting stream's schema"
98+
response=$(curl "${curl_std_opts[@]}" --request GET "$parseable_url"/api/v1/logstream/"$stream_name"/schema)
99+
if [ $? -ne 0 ]; then
100+
echo "Failed to fetch stream's schema with exit code: $?"
101+
exit 1
102+
fi
103+
return 0
104+
}
105+
95106
# Query the log stream and verify if count of events is equal to the number of events posted
96107
query_log_stream() {
97108
echo "Querying the stream: $stream_name"
@@ -116,6 +127,34 @@ query_log_stream() {
116127
return 0
117128
}
118129

130+
# Delete stream
131+
delete_stream () {
132+
echo Deleting Stream: "$stream_name"
133+
response=$(curl "${curl_std_opts[@]}" --request DELETE "$parseable_url"/api/v1/logstream/"$stream_name")
134+
135+
if [ $? -ne 0 ]; then
136+
echo "Failed to delete log stream $stream_name with exit code: $?"
137+
exit 1
138+
fi
139+
140+
http_code=$(tail -n1 <<< "$response")
141+
content=$(sed '$ d' <<< "$response")
142+
if [ "$http_code" -ne 200 ]; then
143+
echo "Failed to delete log stream $stream_name with http code: $http_code and response: $content"
144+
exit 1
145+
fi
146+
147+
if [ "$content" != "LogStream $stream_name deleted" ]; then
148+
echo "Failed to delete log stream $stream_name with response: $content"
149+
exit 1
150+
fi
151+
152+
if [ "$content" = "LogStream $stream_name deleted" ]; then
153+
echo "$stream_name successfully deleted"
154+
fi
155+
return 0
156+
}
157+
119158
cleanup () {
120159
echo "Deleting the $input_file file"
121160
rm -rf "$input_file"
@@ -126,5 +165,7 @@ create_stream
126165
create_input_file
127166
post_event_data
128167
list_log_streams
168+
get_streams_schema
129169
query_log_stream
170+
delete_stream
130171
cleanup

0 commit comments

Comments
 (0)