Skip to content
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
21 changes: 15 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ on:

jobs:
test:
runs-on: macos-13
runs-on: macos-14
permissions:
id-token: write
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
submodules: true
token: ${{ secrets.PAT_FOR_PRIVATE_RUBY }}

- name: Checkout CPP code
uses: actions/checkout@v5
with:
submodules: recursive
token: ${{ secrets.PAT_FOR_CPP }}
repository: awslabs/aws-sdk-cpp-staging
ref: fire-egg-dev
path: test-server/cpp-v2-transition-server/aws-sdk-cpp/

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -35,9 +44,9 @@ jobs:
ruby-version: '3.4'

- name: Set up PHP with Composer
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@verbose
with:
php-version: '8.1'
php-version: '8.1'

- name: Install PHP V2 dependencies
working-directory: ./test-server/php-v2-server
Expand Down Expand Up @@ -68,14 +77,14 @@ jobs:

# Cache Gradle dependencies and build outputs
- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
test-server/java-v3-server/.gradle
test-server/java-tests/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('test-server/java-v3-server/**/*.gradle*', 'test-server/java-tests/**/gradle-wrapper.properties', 'test-server/java-tests/**/*.gradle*', 'test-server/java-v3-server/**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

Expand Down
7 changes: 4 additions & 3 deletions test-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ all: start-servers run-tests
ci: start-servers run-tests stop-servers

SERVER_DIRS := $(shell find . -maxdepth 1 -type d -name '*-server' | sed 's|^\./||' | sort)
# SERVER_DIRS := cpp-v3-server

START_SERVER_TARGETS := $(addprefix start-, $(SERVER_DIRS))
WAIT_SERVER_TARGETS := $(addprefix wait-, $(SERVER_DIRS))
Expand Down Expand Up @@ -56,7 +57,7 @@ run-tests:
AWS_SECRET_ACCESS_KEY="$$AWS_SECRET_ACCESS_KEY" \
AWS_SESSION_TOKEN="$$AWS_SESSION_TOKEN" \
AWS_REGION="us-west-2" \
./gradlew --build-cache --parallel integ -Dtest.filter.servers="$(FILTER)"
./gradlew --build-cache --info --parallel integ -Dtest.filter.servers="$(FILTER)"
@echo "Tests completed successfully"

# Stop the servers
Expand Down Expand Up @@ -106,7 +107,7 @@ wait-for-port:
exit 1; \
fi; \
echo "Waiting for $$PORT to start ($$i/$(TIMEOUT))..."; \
sleep 1; \
sleep 3; \
done

# Here are some helpful curl commands
Expand All @@ -117,4 +118,4 @@ test-create-client:
-H "Content-Type: application/json" \
-H "User-Agent: smithy-java/0.0.3 ua/2.1 os/macos#15.5 lang/java#23.0.2" \
-d '{"config":{"enableLegacyUnauthenticatedModes":false,"enableDelayedAuthenticationMode":false,"enableLegacyWrappingAlgorithms":false,"keyMaterial":{"kmsKeyId":"arn:aws:kms:us-west-2:370957321024:alias/S3EC-Test-Server-Github-KMS-Key"}}}' \
http://localhost:$(PORT)/client
http://localhost:$(PORT)/client
2 changes: 1 addition & 1 deletion test-server/cpp-v2-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PORT := 8085
build/s3ec-server:
brew install libmicrohttpd nlohmann-json ossp-uuid
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp
cd aws-sdk-cpp
mkdir -p build && cd build && cmake ..

start-server: | build/s3ec-server
Expand Down
8 changes: 4 additions & 4 deletions test-server/cpp-v2-server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,18 @@ MHD_Result request_handler(void *cls, struct MHD_Connection *connection,
int main() {
Aws::SDKOptions options;
Aws::InitAPI(options);

int port = 8085;
struct MHD_Daemon *daemon =
MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, 8085, NULL, NULL,
MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, port, NULL, NULL,
&request_handler, NULL, MHD_OPTION_END);

if (!daemon) {
fprintf(stderr, "Failed to start server on port 8085\n");
fprintf(stderr, "Failed to start server on port %d\n", port);
Aws::ShutdownAPI(options);
return 1;
}

fprintf(stderr, "Server running on port 8085\n");
fprintf(stderr, "Server running on port %d\n", port);
sleep(10000);

MHD_stop_daemon(daemon);
Expand Down
39 changes: 39 additions & 0 deletions test-server/cpp-v2-transition-server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.16)
project(s3ec-cpp-v2-server)

set(CMAKE_CXX_STANDARD 17)

# Configure AWS SDK build options
set(BUILD_ONLY "kms;s3;s3-encryption" CACHE STRING "Build only KMS, S3, and S3-encryption components")
set(ENABLE_TESTING OFF CACHE BOOL "Disable testing")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries")

# Add AWS SDK as subdirectory
add_subdirectory(aws-sdk-cpp)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)

find_package(nlohmann_json REQUIRED)

add_executable(s3ec-server main.cpp)

target_include_directories(s3ec-server PRIVATE
${LIBMICROHTTPD_INCLUDE_DIRS}
/opt/homebrew/include
)

target_link_directories(s3ec-server PRIVATE
${LIBMICROHTTPD_LIBRARY_DIRS}
/opt/homebrew/lib
)

target_link_libraries(s3ec-server
${LIBMICROHTTPD_LIBRARIES}
aws-cpp-sdk-core
aws-cpp-sdk-kms
aws-cpp-sdk-s3
aws-cpp-sdk-s3-encryption
nlohmann_json::nlohmann_json
uuid
)
29 changes: 29 additions & 0 deletions test-server/cpp-v2-transition-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Makefile for S3 Encryption Client Testing

.PHONY: start-server stop-server wait-for-server

PID_FILE := server.pid
PORT := 8097

build/s3ec-server:
brew install libmicrohttpd nlohmann-json ossp-uuid
mkdir -p build && cd build && cmake ..

start-server: | build/s3ec-server
@echo "Starting Cpp V2 server..."
cd build && make && \
AWS_ACCESS_KEY_ID="$$AWS_ACCESS_KEY_ID" \
AWS_SECRET_ACCESS_KEY="$$AWS_SECRET_ACCESS_KEY" \
AWS_SESSION_TOKEN="$$AWS_SESSION_TOKEN" \
AWS_REGION="us-west-2" \
./s3ec-server & echo $$! > $(PID_FILE)
@echo "Cpp V2 server starting..."

stop-server:
@if [ -f $(PID_FILE) ]; then \
kill $$(cat $(PID_FILE)) 2>/dev/null || true; \
rm $(PID_FILE); \
fi

wait-for-server:
$(MAKE) -C .. wait-for-port PORT=$(PORT)
37 changes: 37 additions & 0 deletions test-server/cpp-v2-transition-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# C++ S3 Encryption Test Server

Minimal C++ implementation of the S3 Encryption test server.

## Dependencies

- libmicrohttpd
- AWS SDK for C++
- nlohmann/json
- uuid

On MacOS you can
```bash
brew install libmicrohttpd nlohmann-json ossp-uuid
```

## Build

```bash
mkdir build && cd build
cmake ..
make
```

## Run

```bash
./s3ec-server
```

Server runs on localhost:8085

## API Endpoints

- `POST /client` - Create S3 encryption client
- `GET /object/{bucket}/{key}` - Get encrypted object
- `PUT /object/{bucket}/{key}` - Put encrypted object
Loading
Loading