From ba9cf1e4dbe81c27d341defef609cc33c2ee0db0 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 20 Mar 2025 14:25:32 -0700 Subject: [PATCH] Remove unnecessary type aliases from storage btests --- testing/btest/plugins/storage.zeek | 7 ++----- testing/btest/scripts/base/frameworks/storage/erase.zeek | 5 +---- .../btest/scripts/base/frameworks/storage/expiration.zeek | 5 +---- .../btest/scripts/base/frameworks/storage/overwriting.zeek | 5 +---- .../base/frameworks/storage/redis-async-reading-pcap.zeek | 5 +---- .../btest/scripts/base/frameworks/storage/redis-async.zeek | 5 +---- .../scripts/base/frameworks/storage/redis-cluster.zeek | 3 +-- .../scripts/base/frameworks/storage/redis-disconnect.zeek | 5 +---- .../btest/scripts/base/frameworks/storage/redis-erase.zeek | 5 +---- .../scripts/base/frameworks/storage/redis-expiration.zeek | 5 +---- .../base/frameworks/storage/redis-native-expiration.zeek | 5 +---- .../btest/scripts/base/frameworks/storage/redis-sync.zeek | 5 +---- .../base/frameworks/storage/sqlite-basic-reading-pcap.zeek | 5 +---- .../base/frameworks/storage/sqlite-basic-sync-in-when.zeek | 5 +---- .../scripts/base/frameworks/storage/sqlite-basic.zeek | 5 +---- .../base/frameworks/storage/sqlite-error-handling.zeek | 7 ++----- 16 files changed, 18 insertions(+), 64 deletions(-) diff --git a/testing/btest/plugins/storage.zeek b/testing/btest/plugins/storage.zeek index 40948d5ba2..e26b904662 100644 --- a/testing/btest/plugins/storage.zeek +++ b/testing/btest/plugins/storage.zeek @@ -10,9 +10,6 @@ @load base/frameworks/storage/sync -# Create a typename here that can be passed down into get(). -type str: string; - type StorageDummyOpts : record { open_fail: bool; }; @@ -30,7 +27,7 @@ event zeek_init() { # Test basic operation. The second get() should return an error # 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; local b = open_res$value; 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. 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; local close_res = Storage::Sync::close_backend(open_res$value); print "close result of closed handle", close_res; diff --git a/testing/btest/scripts/base/frameworks/storage/erase.zeek b/testing/btest/scripts/base/frameworks/storage/erase.zeek index 7380695b91..772b910855 100644 --- a/testing/btest/scripts/base/frameworks/storage/erase.zeek +++ b/testing/btest/scripts/base/frameworks/storage/erase.zeek @@ -7,9 +7,6 @@ @load base/frameworks/storage/sync @load policy/frameworks/storage/backend/sqlite -# Create a typename here that can be passed down into get(). -type str: string; - event zeek_init() { # 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 # 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/expiration.zeek b/testing/btest/scripts/base/frameworks/storage/expiration.zeek index 4a2d4d01fd..857830233d 100644 --- a/testing/btest/scripts/base/frameworks/storage/expiration.zeek +++ b/testing/btest/scripts/base/frameworks/storage/expiration.zeek @@ -9,9 +9,6 @@ redef Storage::expire_interval = 2 secs; 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 key1: string = "key1234"; global value1: string = "value1234"; @@ -36,7 +33,7 @@ event setup_test() local opts : Storage::BackendOptions; 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; b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/overwriting.zeek b/testing/btest/scripts/base/frameworks/storage/overwriting.zeek index 4a2f7be53b..ec0485d9b2 100644 --- a/testing/btest/scripts/base/frameworks/storage/overwriting.zeek +++ b/testing/btest/scripts/base/frameworks/storage/overwriting.zeek @@ -7,9 +7,6 @@ @load base/frameworks/storage/sync @load policy/frameworks/storage/backend/sqlite -# Create a typename here that can be passed down into get(). -type str: string; - event zeek_init() { local opts : Storage::BackendOptions; opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"]; @@ -17,7 +14,7 @@ event zeek_init() { local key = "key1234"; 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-async-reading-pcap.zeek b/testing/btest/scripts/base/frameworks/storage/redis-async-reading-pcap.zeek index c79e2383bf..85b20450f5 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-async-reading-pcap.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-async-reading-pcap.zeek @@ -13,9 +13,6 @@ @load base/frameworks/storage/async @load policy/frameworks/storage/backend/redis -# Create a typename here that can be passed down into open_backend() -type str: string; - event zeek_init() { local opts: Storage::BackendOptions; @@ -25,7 +22,7 @@ event zeek_init() local key = "key1234"; 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-async.zeek b/testing/btest/scripts/base/frameworks/storage/redis-async.zeek index c58596eff3..5a2339fadc 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-async.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-async.zeek @@ -15,9 +15,6 @@ redef exit_only_after_terminate = T; -# Create a typename here that can be passed down into open_backend() -type str: string; - event zeek_init() { local opts: Storage::BackendOptions; @@ -28,7 +25,7 @@ event zeek_init() local value = "value5678"; 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-cluster.zeek b/testing/btest/scripts/base/frameworks/storage/redis-cluster.zeek index ecc0476066..c2d437400f 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-cluster.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-cluster.zeek @@ -33,7 +33,6 @@ global redis_data_written: event() &is_used; @if ( Cluster::local_node_type() == Cluster::WORKER ) global backend: opaque of Storage::BackendHandle; -type str: string; event zeek_init() { @@ -41,7 +40,7 @@ event zeek_init() opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( "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; } diff --git a/testing/btest/scripts/base/frameworks/storage/redis-disconnect.zeek b/testing/btest/scripts/base/frameworks/storage/redis-disconnect.zeek index c43dcbc99a..ade46312a9 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-disconnect.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-disconnect.zeek @@ -14,9 +14,6 @@ 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) { print "Storage::backend_opened", tag, config; } @@ -35,7 +32,7 @@ event zeek_init() local key = "key1234"; 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; # Kill the redis server so the backend will disconnect and fire the backend_lost event. diff --git a/testing/btest/scripts/base/frameworks/storage/redis-erase.zeek b/testing/btest/scripts/base/frameworks/storage/redis-erase.zeek index edc3752958..bb6f09b477 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-erase.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-erase.zeek @@ -12,9 +12,6 @@ @load base/frameworks/storage/sync @load policy/frameworks/storage/backend/redis -# Create a typename here that can be passed down into open_backend() -type str: string; - event zeek_init() { local opts: Storage::BackendOptions; @@ -24,7 +21,7 @@ event zeek_init() local key = "key1234"; 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-expiration.zeek b/testing/btest/scripts/base/frameworks/storage/redis-expiration.zeek index 3d0ae7042c..ed287aabeb 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-expiration.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-expiration.zeek @@ -15,9 +15,6 @@ redef Storage::expire_interval = 2secs; 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 key1: string = "key1234"; global value1: string = "value1234"; @@ -43,7 +40,7 @@ event setup_test() opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( "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; b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-native-expiration.zeek b/testing/btest/scripts/base/frameworks/storage/redis-native-expiration.zeek index bbcf58a13d..146f89d948 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-native-expiration.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-native-expiration.zeek @@ -15,9 +15,6 @@ redef Storage::expire_interval = 2secs; 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 key1: string = "key1234"; global value1: string = "value1234"; @@ -43,7 +40,7 @@ event setup_test() opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv( "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; b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/redis-sync.zeek b/testing/btest/scripts/base/frameworks/storage/redis-sync.zeek index ee2dc88031..0142b9fef3 100644 --- a/testing/btest/scripts/base/frameworks/storage/redis-sync.zeek +++ b/testing/btest/scripts/base/frameworks/storage/redis-sync.zeek @@ -12,9 +12,6 @@ @load base/frameworks/storage/sync @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) { print "Storage::backend_opened", tag, config; } @@ -33,7 +30,7 @@ event zeek_init() local key = "key1234"; 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/sqlite-basic-reading-pcap.zeek b/testing/btest/scripts/base/frameworks/storage/sqlite-basic-reading-pcap.zeek index b5c0ec8adf..764c9ea8cc 100644 --- a/testing/btest/scripts/base/frameworks/storage/sqlite-basic-reading-pcap.zeek +++ b/testing/btest/scripts/base/frameworks/storage/sqlite-basic-reading-pcap.zeek @@ -9,9 +9,6 @@ redef exit_only_after_terminate = T; -# Create a typename here that can be passed down into get(). -type str: string; - event zeek_init() { # 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 # 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/sqlite-basic-sync-in-when.zeek b/testing/btest/scripts/base/frameworks/storage/sqlite-basic-sync-in-when.zeek index 9679ab56eb..389a07bc31 100644 --- a/testing/btest/scripts/base/frameworks/storage/sqlite-basic-sync-in-when.zeek +++ b/testing/btest/scripts/base/frameworks/storage/sqlite-basic-sync-in-when.zeek @@ -8,9 +8,6 @@ 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) { 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 # the backend yet. 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/sqlite-basic.zeek b/testing/btest/scripts/base/frameworks/storage/sqlite-basic.zeek index 3f37dd352b..1bdde525e2 100644 --- a/testing/btest/scripts/base/frameworks/storage/sqlite-basic.zeek +++ b/testing/btest/scripts/base/frameworks/storage/sqlite-basic.zeek @@ -8,9 +8,6 @@ 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) { 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 # the backend yet. 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; local b = open_res$value; diff --git a/testing/btest/scripts/base/frameworks/storage/sqlite-error-handling.zeek b/testing/btest/scripts/base/frameworks/storage/sqlite-error-handling.zeek index 24c1ed40d0..e85a179cf2 100644 --- a/testing/btest/scripts/base/frameworks/storage/sqlite-error-handling.zeek +++ b/testing/btest/scripts/base/frameworks/storage/sqlite-error-handling.zeek @@ -7,9 +7,6 @@ @load base/frameworks/reporter @load policy/frameworks/storage/backend/sqlite -# Create a typename here that can be passed down into open_backend. -type str: string; - event zeek_init() { # Test opening a database with an invalid path local opts : Storage::BackendOptions; @@ -17,12 +14,12 @@ event zeek_init() { $table_name = "testing"]; # 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; # Open a valid database file 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; local b = open_res$value;