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
1 change: 1 addition & 0 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ jobs:
- "update-without-data-lost.sh v6 v7"
- "update-without-data-lost.sh v7 v6"
- "obsolete-plugins.sh"
- "tmpfiles.sh"
include:
- label: Debian bookworm amd64
rake-job: debian-bookworm
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ jobs:
- "update-without-data-lost.sh v6 v7"
- "update-without-data-lost.sh v7 v6"
- "obsolete-plugins.sh"
- "tmpfiles.sh"
include: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }}
exclude:
- label: Amazon Linux 2023 x86_64
Expand Down
33 changes: 33 additions & 0 deletions fluent-package/apt/systemd-test/tmpfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -exu

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

# Display unit info for debug
sudo systemctl cat systemd-tmpfiles-clean.service
sudo systemctl cat systemd-tmpfiles-clean.timer

# Install the built package
sudo apt install -V -y \
/host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb

# Wait all processes to start
systemctl status --no-pager fluentd
sleep 3

# Test: the files under /tmp/ exist and not be cleaned up by default
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*
sudo systemd-tmpfiles --clean
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*

# Make timestamps old
touch -d "2 months ago" /tmp/fluentd
touch -d "2 months ago" /tmp/fluentd-lock-*

# Test: the files under /tmp/ not be cleaned up even if they are old
sudo systemd-tmpfiles --clean
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*
1 change: 1 addition & 0 deletions fluent-package/templates/usr/lib/tmpfiles.d/fluentd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ d /var/run/<%= package_dir %> 0755 <%= service_name %> <%= service_name %> - -

# Exclude <%= service_name %>
x /tmp/<%= package_dir %>
X /tmp/fluentd-lock-*
34 changes: 34 additions & 0 deletions fluent-package/yum/systemd-test/tmpfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -exu

. $(dirname $0)/common.sh

# Display unit info for debug
sudo systemctl cat systemd-tmpfiles-clean.service
sudo systemctl cat systemd-tmpfiles-clean.timer

# Install the built package
install_current

# Wait all processes to start
(! systemctl status --no-pager fluentd)
sudo systemctl enable --now fluentd
systemctl status --no-pager fluentd
sleep 3

# Test: the files under /tmp/ exist and not be cleaned up by default
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*
sudo systemd-tmpfiles --clean
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*

# Make timestamps old
touch -d "2 months ago" /tmp/fluentd
touch -d "2 months ago" /tmp/fluentd-lock-*

# Test: the files under /tmp/ not be cleaned up even if they are old
sudo systemd-tmpfiles --clean
ls -d /tmp/fluent
ls -d /tmp/fluentd-lock-*
Loading