mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Remove unnecessary type aliases from storage btests
This commit is contained in:
parent
d5ebaf476d
commit
ba9cf1e4db
16 changed files with 18 additions and 64 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue