Skip to content

Update runtime tests to set the architecture for the function #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ci/codebuild/amazonlinux-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 0.2
phases:
pre_build:
commands:
- yum install -y zip
build:
commands:
- cmake3 -S . -B build -DENABLE_TESTS=ON -DTEST_RESOURCE_PREFIX=al2arm -GNinja
- cd build
- ninja-build
- ninja-build aws-lambda-package-lambda-test-fun
- ctest3 --output-on-failure
6 changes: 6 additions & 0 deletions ci/docker/amazon-linux-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2
RUN yum install -y cmake3 ninja-build git gcc-c++ openssl-devel curl-devel
RUN git clone https://github.com/aws/aws-sdk-cpp --recurse-submodules
RUN cmake3 -Saws-sdk-cpp -Baws-sdk-cpp/build -DBUILD_ONLY=lambda -DENABLE_TESTING=OFF -GNinja
RUN cd aws-sdk-cpp/build && ninja-build && ninja-build install
RUN yum install -y openssl-static
2 changes: 1 addition & 1 deletion ci/docker/ubuntu-linux-18.04
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sh cmake-install --skip-license --prefix=/usr --exclude-subdirectory;

RUN pip3 install --upgrade pip

RUN git clone https://github.com/aws/aws-sdk-cpp.git
RUN git clone https://github.com/aws/aws-sdk-cpp.git --recurse-submodules

RUN update-alternatives --set cc /usr/bin/clang
RUN update-alternatives --set c++ /usr/bin/clang++
10 changes: 9 additions & 1 deletion tests/runtime_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <aws/lambda/model/Architecture.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/utils/Array.h>
#include <aws/core/utils/Outcome.h>
Expand All @@ -16,6 +17,7 @@
#include <cstdio>
#include <sys/stat.h>
#include <unistd.h>
#include <vector>

extern std::string aws_prefix;

Expand Down Expand Up @@ -93,7 +95,13 @@ struct LambdaRuntimeTest : public ::testing::Test {
Model::FunctionCode funcode;
funcode.SetZipFile(std::move(zip_file_bytes));
create_function_request.SetCode(std::move(funcode));
create_function_request.SetRuntime(Aws::Lambda::Model::Runtime::provided);
create_function_request.SetRuntime(Aws::Lambda::Model::Runtime::provided_al2);

std::vector<Aws::Lambda::Model::Architecture> lambda_architectures = {Aws::Lambda::Model::Architecture::x86_64};
#ifdef __aarch64__
lambda_architectures[0] = Aws::Lambda::Model::Architecture::arm64;
#endif
Comment on lines +101 to +103
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not always include arm64?

Copy link
Collaborator Author

@bmoffatt bmoffatt Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean like lambda_architectures = {x86_64, arm64}? Because our API would reject it! It doesn't support multi-arch at this time.

create_function_request.SetArchitectures(lambda_architectures);

auto outcome = m_lambda_client.CreateFunction(create_function_request);
ASSERT_TRUE(outcome.IsSuccess()) << "Failed to create function " << function_name;
Expand Down