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
12 changes: 8 additions & 4 deletions .github/workflows/apt.matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
{
"label": "Debian bookworm amd64",
"rake-job": "debian-bookworm",
"test-docker-image": "debian:bookworm"
"test-docker-image": "debian:bookworm",
"test-incus-image": "images:debian/12"
},
{
"label": "Debian trixie amd64",
"rake-job": "debian-trixie",
"test-docker-image": "debian:trixie"
"test-docker-image": "debian:trixie",
"test-incus-image": "images:debian/13"
},
{
"label": "Ubuntu Jammy amd64",
"rake-job": "ubuntu-jammy",
"test-docker-image": "ubuntu:jammy"
"test-docker-image": "ubuntu:jammy",
"test-incus-image": "images:ubuntu/22.04"
},
{
"label": "Ubuntu Noble amd64",
"rake-job": "ubuntu-noble",
"test-docker-image": "ubuntu:noble"
"test-docker-image": "ubuntu:noble",
"test-incus-image": "images:ubuntu/24.04"
}
]
}
27 changes: 26 additions & 1 deletion .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ jobs:
/fluentd/fluent-package/apt/binstubs-test.sh
test:
name: Test ${{ matrix.label }} ${{ matrix.test }}
needs: [check_package_size, installation_test, piuparts_test, serverspec_test, confluent_test, binstubs_test]
needs: [check_package_size, installation_test, piuparts_test, serverspec_test, binstubs_test]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
Expand Down Expand Up @@ -320,3 +320,28 @@ jobs:
--volume ${PWD}:/fluentd:ro \
${{ matrix.test-docker-image }} \
/fluentd/fluent-package/apt/confluent-test.sh

s3_test:
name: S3 Test (${{ matrix.label }} s3.sh
needs: [define-matrix, test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages-${{ matrix.rake-job }}
- name: Setup Incus
run: ./fluent-package/test-tools/setup-incus.sh
- name: Setup localstack on host
run: |
docker run -d --name localstack -p 4566:4566 \
-e AWS_ACCESS_KEY_ID=localstack-test -e AWS_SECRET_ACCESS_KEY=localstack-test -e AWS_DEFAULT_REGION=ap-northeast-1 localstack/localstack:4.13.1
- name: Copy s3.conf
run: cp fluent-package/test-tools/s3.conf fluent-package/apt/systemd-test
- name: Ensure localstack availability from host
run: sleep 10 && curl http://127.0.0.1:4566/_localstack/health
- name: Run Test ${{matrix.test}} on ${{ matrix.test-incus-image }}
run: fluent-package/apt/systemd-test/test.sh ${{ matrix.test-incus-image }} s3.sh
27 changes: 26 additions & 1 deletion .github/workflows/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ jobs:

v2test:
name: Test ${{ matrix.label }} ${{ matrix.test }} (CGroup V2)
needs: [define-matrix, check_package_size, installation_test, serverspec_test, confluent_test, binstubs_test]
needs: [define-matrix, check_package_size, installation_test, serverspec_test, binstubs_test]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
Expand Down Expand Up @@ -413,3 +413,28 @@ jobs:
run: ./fluent-package/test-tools/setup-incus.sh
- name: Run Test ${{matrix.test}} on ${{ matrix.test-incus-image }}
run: fluent-lts-release/yum/systemd-test/test.sh ${{ matrix.test-incus-image }} ${{ matrix.test }}

s3_test:
name: S3 Test (${{ matrix.label }} s3.sh
needs: [define-matrix, v2test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages-${{ matrix.rake-job }}
- name: Setup Incus
run: ./fluent-package/test-tools/setup-incus.sh
- name: Setup localstack on host
run: |
docker run -d --name localstack -p 4566:4566 \
-e AWS_ACCESS_KEY_ID=localstack-test -e AWS_SECRET_ACCESS_KEY=localstack-test -e AWS_DEFAULT_REGION=ap-northeast-1 localstack/localstack:4.13.1
- name: Copy s3.conf
run: cp fluent-package/test-tools/s3.conf fluent-package/yum/systemd-test
- name: Ensure localstack availability from host
run: sleep 10 && curl http://127.0.0.1:4566/_localstack/health
- name: Run Test s3.sh on ${{ matrix.test-incus-image }}
run: fluent-package/yum/systemd-test/test.sh ${{ matrix.test-incus-image }} s3.sh
15 changes: 15 additions & 0 deletions fluent-package/apt/commonvar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,18 @@ function test_suppressed_needrestart()
esac
fi
}

function install_aws_cli()
{
case $architecture in
amd64)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
;;
arm64)
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
;;
esac
sudo apt install -y unzip
unzip awscliv2.zip
sudo ./aws/install
}
29 changes: 29 additions & 0 deletions fluent-package/apt/systemd-test/s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -exu

. $(dirname $0)/../commonvar.sh

# Install the current
sudo apt install -V -y \
/host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb
systemctl stop --no-pager fluentd

install_aws_cli

# Overwrite with s3.conf
GATEWAY=$(ip route | grep default | cut -d' ' -f3)
sed -e "s/127.0.0.1/${GATEWAY}/" /host/fluent-package/apt/systemd-test/s3.conf | sudo tee /etc/fluent/fluentd.conf

# Check container => host localstack connectivity
curl http://${GATEWAY}:4566/_localstack/health

sudo systemctl enable --now fluentd
systemctl status --no-pager fluentd

# wait loading sample data
sleep 20

# Check existence of .json in localstack-bucket
count=$(AWS_ACCESS_KEY_ID=localstack-test AWS_SECRET_ACCESS_KEY=localstack-test aws --endpoint-url=http://${GATEWAY}:4566 s3 ls localstack-bucket | grep -c json)
test $count -ge 1
31 changes: 31 additions & 0 deletions fluent-package/test-tools/s3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<source>
@type sample
tag test
</source>

<match **>
@type s3

aws_key_id localstack-test
aws_sec_key localstack-test
s3_region ap-northeast-1
s3_bucket localstack-bucket
s3_endpoint http://127.0.0.1:4566
ssl_verify_peer false
force_path_style true
path logs-%Y-%m-%d
s3_object_key_format %{path}-%{index}.json
auto_create_bucket true

<buffer time>
@type file
timekey 10s
timekey_wait 5s
path /tmp/test/s3
flush_at_shutdown true
flush_interval 0.1
</buffer>
<format>
@type json
</format>
</match>
18 changes: 18 additions & 0 deletions fluent-package/yum/systemd-test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,21 @@ function install_v6_lts()
;;
esac
}

function install_aws_cli()
{
ARCH=$(rpm --eval '%{_arch}')
case $ARCH in
x86_64)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
;;
arm*)
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
;;
*)
;;
esac
sudo $DNF install -y unzip
unzip awscliv2.zip
sudo ./aws/install
}
27 changes: 27 additions & 0 deletions fluent-package/yum/systemd-test/s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -exu

. $(dirname $0)/common.sh

install_current
install_aws_cli

(! systemctl status --no-pager fluentd)

# Overwrite with s3.conf
GATEWAY=$(ip route | grep default | cut -d' ' -f3)
sed -e "s/127.0.0.1/${GATEWAY}/" /host/fluent-package/yum/systemd-test/s3.conf | sudo tee /etc/fluent/fluentd.conf

# Check container => host localstack connectivity
curl http://${GATEWAY}:4566/_localstack/health

sudo systemctl enable --now fluentd
systemctl status --no-pager fluentd

# wait loading sample data
sleep 20

# Check existence of .json in localstack-bucket
count=$(AWS_ACCESS_KEY_ID=localstack-test AWS_SECRET_ACCESS_KEY=localstack-test aws --endpoint-url=http://${GATEWAY}:4566 s3 ls localstack-bucket | grep -c json)
test $count -ge 1
Loading