Skip to content

Commit

Permalink
test: Update e2e tests to use server 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Nov 16, 2023
1 parent 1775df0 commit 4adbbc6
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 116 deletions.
12 changes: 12 additions & 0 deletions lib/collectinfo_analyzer/get_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,15 @@ def get_role(
] = self.log_handler.admin_acl(stanza=constants.ADMIN_ROLES, nodes=nodes)

return GetAclController.new_dict_with_key(data, role_name)


class GetClusterMetadataController:
# TODO: do we need this? Technically asadm only really ever deals with metadata. I
# want this to handle things that arn't configs or stats . . .

def __init__(self, log_analyzer: CollectinfoLogHandler):
self.log_handler = log_analyzer

async def get_builds(self) -> TimestampDict[NodeDict[str]]:
builds = self.log_handler.info_meta_data(stanza="asd_build")
return util.filter_exceptions(builds)
21 changes: 19 additions & 2 deletions lib/collectinfo_analyzer/show_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

from lib.collectinfo_analyzer.get_controller import (
GetAclController,
GetClusterMetadataController,
GetConfigController,
GetStatisticsController,
)
from lib.utils import common, constants, util
from lib.utils import common, constants, util, version
from lib.base_controller import CommandHelp, CommandName, ModifierHelp

from .collectinfo_command_controller import CollectinfoCommandController
Expand Down Expand Up @@ -785,6 +786,7 @@ def __init__(self):
self.getter = GetStatisticsController(
self.log_handler
) # TODO: Use this getter for more than just xdr
self.meta_getter = GetClusterMetadataController(self.log_handler)

@CommandHelp(
"Displays bin, set, service, and namespace statistics",
Expand Down Expand Up @@ -976,7 +978,7 @@ def do_sets(self, line):
like_stat_modifier_help,
),
)
def do_bins(self, line):
async def do_bins(self, line):
show_total = util.check_arg_and_delete_from_mods(
line=line, arg="-t", default=False, modifiers=self.modifiers, mods=self.mods
)
Expand Down Expand Up @@ -1004,6 +1006,21 @@ def do_bins(self, line):
mods=self.mods,
)

builds = await self.meta_getter.get_builds()

for timestamp in sorted(builds.keys()):
nodes_builds = builds[timestamp]
if any(
[
version.LooseVersion(build)
>= version.LooseVersion(constants.SERVER_INFO_BINS_REMOVAL_VERSION)
for build in nodes_builds.values()
]
):
self.logger.error(
f"Server version {constants.SERVER_INFO_BINS_REMOVAL_VERSION} removed namespace bin-name limits and statistics."
)

new_bin_stats = self.log_handler.info_statistics(
stanza=constants.STAT_BINS, flip=True
)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/aerospike.conf → test/e2e/aerospike_6.x.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
${security_stanza}

service {
cluster-name 6.x-asadm-test
feature-key-file ${feature_path}
run-as-daemon false
work-directory ${state_directory}
Expand Down
94 changes: 94 additions & 0 deletions test/e2e/aerospike_latest.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Aerospike Asadm Test Configuration Template
#
# Copyright (c) 2008-2023 Aerospike, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

${security_stanza}

service {
cluster-name 7.x-asadm-test
feature-key-file ${feature_path}
run-as-daemon false
work-directory ${state_directory}
pidfile ${state_directory}/asd.pid
proto-fd-max 1024
transaction-retry-ms 10000
transaction-max-ms 10000
}

logging {
console {
context any info
context security info
}
file ${log_path} {
context any info
}
}

mod-lua {
user-path ${udf_directory}
}

network {
service {
port ${service_port}
address any
access-address ${access_address}
}

heartbeat {
mode mesh
address any
port ${heartbeat_port}
interval 100
timeout 3
connect-timeout-ms 100
${peer_connection}
}

fabric {
port ${fabric_port}
address any
}

info {
port ${info_port}
address any
}
}

namespace ${namespace} {
replication-factor 2
default-ttl 0
storage-engine memory {
file /opt/aerospike/data/test.dat
filesize 1G
}
nsup-period 60
}

xdr {
dc DC1 {
namespace ${namespace} {
}
}
}
15 changes: 12 additions & 3 deletions test/e2e/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def start_server(
first_base,
index,
access_address="127.0.0.1",
docker_tag="latest",
template_file="aerospike_latest.conf",
template_content=None,
config_content=None,
):
Expand All @@ -299,7 +301,7 @@ def start_server(
base = first_base + 1000 * (index - 1)

if template_content is None and not config_content:
template_file = absolute_path("aerospike.conf")
template_file = absolute_path(template_file)
with codecs.open(template_file, "r", "UTF-8") as file_obj:
template_content = file_obj.read()

Expand Down Expand Up @@ -329,7 +331,7 @@ def start_server(
pass

container = DOCKER_CLIENT.containers.run(
"aerospike/aerospike-server-enterprise:latest",
f"aerospike/aerospike-server-enterprise:{docker_tag}",
command=cmd,
ports={
str(base) + "/tcp": str(base),
Expand All @@ -352,7 +354,12 @@ def start_server(


def start(
do_reset=True, num_nodes=DEFAULT_N_NODES, template_content=None, config_content=None
do_reset=True,
num_nodes=DEFAULT_N_NODES,
docker_tag="latest",
template_file="aerospike_latest.conf",
template_content=None,
config_content=None,
):
global CLIENT
global NODES
Expand All @@ -373,6 +380,8 @@ def start(
ip = start_server(
first_base,
index,
docker_tag=docker_tag,
template_file=template_file,
template_content=template_content,
config_content=config_content,
)
Expand Down
Loading

0 comments on commit 4adbbc6

Please sign in to comment.