Skip to content

Fix non http promtail config add spec tests#26

Open
jorbaum wants to merge 2 commits intocloudfoundry-community:mainfrom
jorbaum:fix-non-http-promtail-config-add-spec-tests
Open

Fix non http promtail config add spec tests#26
jorbaum wants to merge 2 commits intocloudfoundry-community:mainfrom
jorbaum:fix-non-http-promtail-config-add-spec-tests

Conversation

@jorbaum
Copy link
Copy Markdown
Contributor

@jorbaum jorbaum commented Aug 11, 2025

This mainly fixes a minor typo.

While I was at it I also added some tests and GitHub workflow for it based on
https://github.com/cloudfoundry/otel-collector-release

Only the two properties of the promtail config file are being tested for now.

- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure if its OK to use newer version here?

@jorbaum
Copy link
Copy Markdown
Contributor Author

jorbaum commented Mar 11, 2026

@ZPascal can you take a look at it?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the promtail Loki client URL scheme selection (http vs https) in the BOSH template and adds an RSpec-based spec test + CI workflow to validate the rendered config.

Changes:

  • Correct the promtail Loki client URL to use http:// when TLS/mTLS is disabled.
  • Add an RSpec test verifying the rendered Loki client URL scheme.
  • Add Ruby/Bundler setup (Gemfile/lock), a spec-test script, and a GitHub Actions workflow to run the specs.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
jobs/promtail/templates/config/config.yml.erb Fixes URL scheme logic for the Loki client endpoint.
spec/jobs/promtail_spec.rb Adds spec coverage for http vs https Loki client URL rendering.
scripts/subtests/spec-test Adds a script entrypoint for running the spec suite via bundler.
Gemfile Introduces Ruby dependencies needed for spec testing.
Gemfile.lock Locks Ruby dependency versions for reproducible CI runs.
.github/workflows/scripts.yml Runs the spec-test script on PRs/pushes to main.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

require 'bosh/template/test'

describe 'promtail config/config.yml.erb' do
let(:release_dir) { File.join(File.dirname(__FILE__), '../..') }
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

release_dir currently resolves to <repo>/spec, but Bosh::Template::Test::ReleaseDir expects the BOSH release root (where jobs/, packages/, etc live). With the current path, release.job('promtail') will fail to find the job. Consider using File.expand_path('../../..', __dir__) (or equivalent) to point to the repository root.

Suggested change
let(:release_dir) { File.join(File.dirname(__FILE__), '../..') }
let(:release_dir) { File.expand_path('../../..', __dir__) }

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'rspec'
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

This spec uses YAML.safe_load but does not require 'yaml'. Depending on load order, YAML may not be defined, causing the spec to fail in CI. Add an explicit require 'yaml' near the other requires.

Suggested change
require 'rspec'
require 'rspec'
require 'yaml'

Copilot uses AI. Check for mistakes.
#!/bin/bash

set -eux
set -o pipefail
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can be handled in one line :)

Comment thread Gemfile.lock
semi_semantic (1.2.0)

PLATFORMS
arm64-darwin-24
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to use the Linux platform instead.

- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please use a newer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants