Remove unnecessary type aliases from storage btests

This commit is contained in:
Tim Wojtulewicz 2025-03-20 14:25:32 -07:00
parent d5ebaf476d
commit ba9cf1e4db
16 changed files with 18 additions and 64 deletions

View file

@ -10,9 +10,6 @@
@load base/frameworks/storage/sync @load base/frameworks/storage/sync
# Create a typename here that can be passed down into get().
type str: string;
type StorageDummyOpts : record { type StorageDummyOpts : record {
open_fail: bool; open_fail: bool;
}; };
@ -30,7 +27,7 @@ event zeek_init() {
# Test basic operation. The second get() should return an error # Test basic operation. The second get() should return an error
# as the key should have been erased. # as the key should have been erased.
local open_res = Storage::Sync::open_backend(Storage::STORAGEDUMMY, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::STORAGEDUMMY, opts, string, string);
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;
local put_res = Storage::Sync::put(b, [$key=key, $value=value, $overwrite=F]); local put_res = Storage::Sync::put(b, [$key=key, $value=value, $overwrite=F]);
@ -56,7 +53,7 @@ event zeek_init() {
# Test failing to open the handle and test closing an invalid handle. # Test failing to open the handle and test closing an invalid handle.
opts$dummy$open_fail = T; opts$dummy$open_fail = T;
open_res = Storage::Sync::open_backend(Storage::STORAGEDUMMY, opts, str, str); open_res = Storage::Sync::open_backend(Storage::STORAGEDUMMY, opts, string, string);
print "open result 2", open_res; print "open result 2", open_res;
local close_res = Storage::Sync::close_backend(open_res$value); local close_res = Storage::Sync::close_backend(open_res$value);
print "close result of closed handle", close_res; print "close result of closed handle", close_res;

View file

@ -7,9 +7,6 @@
@load base/frameworks/storage/sync @load base/frameworks/storage/sync
@load policy/frameworks/storage/backend/sqlite @load policy/frameworks/storage/backend/sqlite
# Create a typename here that can be passed down into get().
type str: string;
event zeek_init() event zeek_init()
{ {
# Create a database file in the .tmp directory with a 'testing' table # Create a database file in the .tmp directory with a 'testing' table
@ -20,7 +17,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in # Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet. # the backend yet.
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -9,9 +9,6 @@
redef Storage::expire_interval = 2 secs; redef Storage::expire_interval = 2 secs;
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into get().
type str: string;
global b: opaque of Storage::BackendHandle; global b: opaque of Storage::BackendHandle;
global key1: string = "key1234"; global key1: string = "key1234";
global value1: string = "value1234"; global value1: string = "value1234";
@ -36,7 +33,7 @@ event setup_test()
local opts : Storage::BackendOptions; local opts : Storage::BackendOptions;
opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"]; opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"];
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "open result", open_res; print "open result", open_res;
b = open_res$value; b = open_res$value;

View file

@ -7,9 +7,6 @@
@load base/frameworks/storage/sync @load base/frameworks/storage/sync
@load policy/frameworks/storage/backend/sqlite @load policy/frameworks/storage/backend/sqlite
# Create a typename here that can be passed down into get().
type str: string;
event zeek_init() { event zeek_init() {
local opts : Storage::BackendOptions; local opts : Storage::BackendOptions;
opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"]; opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"];
@ -17,7 +14,7 @@ event zeek_init() {
local key = "key1234"; local key = "key1234";
local value = "value7890"; local value = "value7890";
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -13,9 +13,6 @@
@load base/frameworks/storage/async @load base/frameworks/storage/async
@load policy/frameworks/storage/backend/redis @load policy/frameworks/storage/backend/redis
# Create a typename here that can be passed down into open_backend()
type str: string;
event zeek_init() event zeek_init()
{ {
local opts: Storage::BackendOptions; local opts: Storage::BackendOptions;
@ -25,7 +22,7 @@ event zeek_init()
local key = "key1234"; local key = "key1234";
local value = "value5678"; local value = "value5678";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -15,9 +15,6 @@
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into open_backend()
type str: string;
event zeek_init() event zeek_init()
{ {
local opts: Storage::BackendOptions; local opts: Storage::BackendOptions;
@ -28,7 +25,7 @@ event zeek_init()
local value = "value5678"; local value = "value5678";
when [opts, key, value] ( local open_res = Storage::Async::open_backend( when [opts, key, value] ( local open_res = Storage::Async::open_backend(
Storage::REDIS, opts, str, str) ) Storage::REDIS, opts, string, string) )
{ {
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -33,7 +33,6 @@ global redis_data_written: event() &is_used;
@if ( Cluster::local_node_type() == Cluster::WORKER ) @if ( Cluster::local_node_type() == Cluster::WORKER )
global backend: opaque of Storage::BackendHandle; global backend: opaque of Storage::BackendHandle;
type str: string;
event zeek_init() event zeek_init()
{ {
@ -41,7 +40,7 @@ event zeek_init()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ]; "REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
backend = open_res$value; backend = open_res$value;
} }

View file

@ -14,9 +14,6 @@
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into open_backend()
type str: string;
event Storage::backend_opened(tag: string, config: any) { event Storage::backend_opened(tag: string, config: any) {
print "Storage::backend_opened", tag, config; print "Storage::backend_opened", tag, config;
} }
@ -35,7 +32,7 @@ event zeek_init()
local key = "key1234"; local key = "key1234";
local value = "value1234"; local value = "value1234";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open_result", open_res; print "open_result", open_res;
# Kill the redis server so the backend will disconnect and fire the backend_lost event. # Kill the redis server so the backend will disconnect and fire the backend_lost event.

View file

@ -12,9 +12,6 @@
@load base/frameworks/storage/sync @load base/frameworks/storage/sync
@load policy/frameworks/storage/backend/redis @load policy/frameworks/storage/backend/redis
# Create a typename here that can be passed down into open_backend()
type str: string;
event zeek_init() event zeek_init()
{ {
local opts: Storage::BackendOptions; local opts: Storage::BackendOptions;
@ -24,7 +21,7 @@ event zeek_init()
local key = "key1234"; local key = "key1234";
local value = "value1234"; local value = "value1234";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open_result", open_res; print "open_result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -15,9 +15,6 @@
redef Storage::expire_interval = 2secs; redef Storage::expire_interval = 2secs;
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into open_backend()
type str: string;
global b: opaque of Storage::BackendHandle; global b: opaque of Storage::BackendHandle;
global key1: string = "key1234"; global key1: string = "key1234";
global value1: string = "value1234"; global value1: string = "value1234";
@ -43,7 +40,7 @@ event setup_test()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ]; "REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open result", open_res; print "open result", open_res;
b = open_res$value; b = open_res$value;

View file

@ -15,9 +15,6 @@
redef Storage::expire_interval = 2secs; redef Storage::expire_interval = 2secs;
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into open_backend()
type str: string;
global b: opaque of Storage::BackendHandle; global b: opaque of Storage::BackendHandle;
global key1: string = "key1234"; global key1: string = "key1234";
global value1: string = "value1234"; global value1: string = "value1234";
@ -43,7 +40,7 @@ event setup_test()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ]; "REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open result", open_res; print "open result", open_res;
b = open_res$value; b = open_res$value;

View file

@ -12,9 +12,6 @@
@load base/frameworks/storage/sync @load base/frameworks/storage/sync
@load policy/frameworks/storage/backend/redis @load policy/frameworks/storage/backend/redis
# Create a typename here that can be passed down into open_backend()
type str: string;
event Storage::backend_opened(tag: string, config: any) { event Storage::backend_opened(tag: string, config: any) {
print "Storage::backend_opened", tag, config; print "Storage::backend_opened", tag, config;
} }
@ -33,7 +30,7 @@ event zeek_init()
local key = "key1234"; local key = "key1234";
local value = "value1234"; local value = "value1234";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
print "open_result", open_res; print "open_result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -9,9 +9,6 @@
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into get().
type str: string;
event zeek_init() event zeek_init()
{ {
# Create a database file in the .tmp directory with a 'testing' table # Create a database file in the .tmp directory with a 'testing' table
@ -23,7 +20,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in # Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet. # the backend yet.
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -8,9 +8,6 @@
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into get().
type str: string;
event Storage::backend_opened(tag: string, config: any) { event Storage::backend_opened(tag: string, config: any) {
print "Storage::backend_opened", tag, config; print "Storage::backend_opened", tag, config;
} }
@ -27,7 +24,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in # Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet. # the backend yet.
when [opts, key, value] ( local open_res = Storage::Sync::open_backend( when [opts, key, value] ( local open_res = Storage::Sync::open_backend(
Storage::SQLITE, opts, str, str) ) Storage::SQLITE, opts, string, string) )
{ {
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -8,9 +8,6 @@
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Create a typename here that can be passed down into get().
type str: string;
event Storage::backend_opened(tag: string, config: any) { event Storage::backend_opened(tag: string, config: any) {
print "Storage::backend_opened", tag, config; print "Storage::backend_opened", tag, config;
} }
@ -27,7 +24,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in # Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet. # the backend yet.
when [opts, key, value] ( local open_res = Storage::Async::open_backend( when [opts, key, value] ( local open_res = Storage::Async::open_backend(
Storage::SQLITE, opts, str, str) ) Storage::SQLITE, opts, string, string) )
{ {
print "open result", open_res; print "open result", open_res;
local b = open_res$value; local b = open_res$value;

View file

@ -7,9 +7,6 @@
@load base/frameworks/reporter @load base/frameworks/reporter
@load policy/frameworks/storage/backend/sqlite @load policy/frameworks/storage/backend/sqlite
# Create a typename here that can be passed down into open_backend.
type str: string;
event zeek_init() { event zeek_init() {
# Test opening a database with an invalid path # Test opening a database with an invalid path
local opts : Storage::BackendOptions; local opts : Storage::BackendOptions;
@ -17,12 +14,12 @@ event zeek_init() {
$table_name = "testing"]; $table_name = "testing"];
# This should report an error in .stderr and reporter.log # This should report an error in .stderr and reporter.log
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "Open result", open_res; print "Open result", open_res;
# Open a valid database file # Open a valid database file
opts$sqlite$database_path = "test.sqlite"; opts$sqlite$database_path = "test.sqlite";
open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str); open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
print "Open result 2", open_res; print "Open result 2", open_res;
local b = open_res$value; local b = open_res$value;