Skip to content

refactor(test): Change BBB_URL env variable pattern - #23422

Closed
antonbsa wants to merge 3 commits into
bigbluebutton:v3.0.x-releasefrom
antonbsa:validate-test-variables
Closed

antonbsa wants to merge 3 commits into
bigbluebutton:v3.0.x-releasefrom
antonbsa:validate-test-variables

Conversation

@antonbsa

Copy link
Copy Markdown
Contributor

What does this PR do?

BREAKING CHANGE: BBB_URL variable pattern changed from "https://DOMAIN_NAME/bigbluebutton/api" to "https://DOMAIN_NAME/bigbluebutton/" (api/ removed - now it will be the same as logged by bbb-conf --secret)

Also:

  • validates BBB_URL and BBB_SECRET variables before running tests;
  • .env.template and README updated
  • automated tests workflow updated

Motivation

  • There was no declarative error in case any variables weren't set or the wrong pattern;
  • Keep consistent using the same pattern logged by the bbb-conf command;

- validate server variables before running tests
- .env.template and README updated
@antonbsa antonbsa added this to the Release 3.0 milestone Jun 18, 2025
@coderabbitai

coderabbitai Bot commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

"""

Walkthrough

The changes update the handling and validation of the BBB_URL environment variable throughout the test suite. The expected format for BBB_URL is changed from ending with /bigbluebutton/api to /bigbluebutton/, and related documentation and template comments are updated accordingly. The workflow configuration, environment variable extraction, and test scripts are aligned with this new format. Additionally, several utility modules are refactored to directly use or export the hostname from the parameters module, and the construction of API endpoint URLs is standardized to explicitly include the /api/ segment. Environment variable validation is added to the test fixture setup.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant Playwright Tests
    participant BBB Server

    Developer->>GitHub Actions: Push code / PR triggers workflow
    GitHub Actions->>Playwright Tests: Set BBB_URL (ending with /bigbluebutton/)
    Playwright Tests->>Playwright Tests: Validate BBB_URL and BBB_SECRET
    Playwright Tests->>BBB Server: Make API calls to /bigbluebutton/api/...
    BBB Server-->>Playwright Tests: Respond to API requests
    Playwright Tests-->>GitHub Actions: Report test results
Loading

Suggested labels

test Firefox

Suggested reviewers

  • lfzawacki
  • gustavotrott
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 266b21f and 82dfee9.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • bigbluebutton-html5/package.json (1 hunks)
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-html5/package.json
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-graphql-server)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
bigbluebutton-tests/playwright/README.md (1)

17-17: Good documentation simplification - removes format duplication.

Removing the specific BBB_URL format requirement from the README eliminates duplication since the format is already documented in .env.template. This makes the documentation more maintainable.

The LanguageTool hints suggest minor stylistic improvements:

-To run these tests with an existing BigBlueButton server, you need to find the server's URL and secret (can be done with `bbb-conf --secret` command). You need to put them into the `.env` file inside `bigbluebutton-tests/playwright` folder (variables `BBB_URL` and `BBB_SECRET`).
+To run these tests with an existing BigBlueButton server, you must find the server's URL and secret (can be done with `bbb-conf --secret` command). You must put them into the `.env` file inside the `bigbluebutton-tests/playwright` folder (variables `BBB_URL` and `BBB_SECRET`).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69e648d and 51a43f5.

📒 Files selected for processing (9)
  • .github/workflows/automated-tests.yml (3 hunks)
  • bigbluebutton-tests/playwright/.env.template (1 hunks)
  • bigbluebutton-tests/playwright/README.md (1 hunks)
  • bigbluebutton-tests/playwright/connectionFailure/util.js (1 hunks)
  • bigbluebutton-tests/playwright/core/helpers.js (3 hunks)
  • bigbluebutton-tests/playwright/core/parameters.js (1 hunks)
  • bigbluebutton-tests/playwright/fixtures.js (2 hunks)
  • bigbluebutton-tests/playwright/package.json (1 hunks)
  • bigbluebutton-tests/playwright/reconnection/util.js (1 hunks)
🧰 Additional context used
🪛 LanguageTool
bigbluebutton-tests/playwright/README.md

[style] ~17-~17: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...h an existing BigBlueButton server, you need to find the server's URL and secret (can b...

(REP_NEED_TO_VB)


[style] ~17-~17: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ... with bbb-conf --secret command). You need to put them into the .env file inside `b...

(REP_NEED_TO_VB)


[uncategorized] ~17-~17: You might be missing the article “the” here.
Context: ...to put them into the .env file inside bigbluebutton-tests/playwright folder (...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 Biome (1.9.4)
bigbluebutton-tests/playwright/core/parameters.js

[error] 3-3: A global variable should not be reassigned.

Assigning to a global variable can override essential functionality.

(lint/suspicious/noGlobalAssign)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (14)
bigbluebutton-tests/playwright/.env.template (1)

2-2: LGTM! Clear documentation update.

The updated comment clearly specifies the new URL format and provides helpful context by referencing the bbb-conf --secret command. This aligns well with the PR objective to standardize the BBB_URL pattern.

bigbluebutton-tests/playwright/core/parameters.js (3)

1-2: Good refactoring to reduce repeated environment variable access.

Extracting BBB_URL to a local constant improves code efficiency and readability.


4-4: Consistent with the local constant optimization.

Using the local bbbUrl constant instead of repeatedly accessing process.env.BBB_URL is a good practice.


10-10: Verify hostname extraction handles edge cases.

The hostname extraction logic looks correct for valid URLs. However, consider edge cases where bbbUrl might be malformed.

#!/bin/bash
# Description: Check if there are any existing validation patterns for BBB_URL format in the codebase

# Test: Search for BBB_URL validation patterns. Expect: Find validation logic that might already handle malformed URLs.
rg -A 5 -B 2 'BBB_URL.*valid|valid.*BBB_URL|BBB_URL.*format|format.*BBB_URL'
.github/workflows/automated-tests.yml (3)

137-137: Consistent workflow update for new BBB_URL format.

The BBB_URL environment variable is correctly updated to the new format ending with /bigbluebutton/ instead of /bigbluebutton/api.


148-148: Consistent with the main test job.

Firefox test job correctly uses the same BBB_URL format as the main test job.


267-267: Plugin test job updated consistently.

Plugin test job correctly uses the new BBB_URL format, maintaining consistency across all test jobs.

bigbluebutton-tests/playwright/connectionFailure/util.js (1)

4-4: Excellent refactoring - leverages centralized hostname extraction.

Directly importing hostname from parameters.js eliminates code duplication and leverages the centralized URL parsing. This improves maintainability and consistency across the codebase.

bigbluebutton-tests/playwright/reconnection/util.js (1)

3-3: LGTM! Good simplification by using the pre-extracted hostname.

This change eliminates redundant URL parsing by directly importing the hostname from the parameters module, which now exports it as a separate property. This is more efficient and cleaner than the previous approach of parsing the URL locally.

bigbluebutton-tests/playwright/package.json (1)

4-4: LGTM! Correctly removes the /api suffix appending.

This change aligns perfectly with the new BBB_URL format. The removed sed expression was appending /api to the URL extracted from bbb-conf --secret, which is no longer needed since the base URL format has been standardized to end with /bigbluebutton/ and API paths are now handled explicitly in the helper functions.

bigbluebutton-tests/playwright/core/helpers.js (1)

42-42: LGTM! Correctly adds explicit /api/ path to maintain proper API endpoints.

These changes are essential to ensure API calls continue to work correctly with the new BBB_URL format. Since the base URL no longer includes /api, it must be explicitly added when constructing API endpoint URLs. The implementation is consistent across all three functions (apiCallUrl, createMeetingUrl, and getJoinURL) that build BigBlueButton API URLs.

Also applies to: 60-60, 84-84

bigbluebutton-tests/playwright/fixtures.js (3)

3-3: LGTM! Excellent addition of environment variable validation.

The new validation logic ensures tests fail fast with clear error messages when environment variables are missing or incorrectly formatted. This provides a much better developer experience than cryptic failures later in the test execution.

Also applies to: 19-25


5-16: ```shell
#!/bin/bash

Re-run search for the old hook name across all file types to ensure no lingering references

rg -i "sharedEachTestHook"


---

`20-20`: **Verify the regex pattern handles all valid domain formats.**

The regex pattern looks correct for the new BBB_URL format, but let's verify it handles edge cases properly.



```shell
#!/bin/bash
# Test the regex pattern against various URL formats
python3 -c "
import re

pattern = r'^https:\/\/[^\/]+\/bigbluebutton\/$'

# Valid URLs that should match
valid_urls = [
    'https://example.com/bigbluebutton/',
    'https://bbb.example.com/bigbluebutton/',
    'https://example-test.com/bigbluebutton/',
    'https://192.168.1.100/bigbluebutton/',
    'https://localhost:8080/bigbluebutton/'
]

# Invalid URLs that should not match
invalid_urls = [
    'https://example.com/bigbluebutton/api',
    'https://example.com/bigbluebutton',
    'http://example.com/bigbluebutton/',
    'https://example.com/bigbluebutton//',
    'https://example.com/',
    'https:/example.com/bigbluebutton/',
    'https://example.com/bigbluebutton/extra'
]

print('Testing valid URLs:')
for url in valid_urls:
    match = bool(re.match(pattern, url))
    print(f'{url}: {\"PASS\" if match else \"FAIL\"}')

print('\nTesting invalid URLs:')
for url in invalid_urls:
    match = bool(re.match(pattern, url))
    print(f'{url}: {\"PASS\" if not match else \"FAIL\"}')
"

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
bigbluebutton-html5/package.json (1)

60-60: Pin plugin SDK dependency for reproducibility

The tarball URL targets the mutable PR head and may change as new commits land. For stable, repeatable installs, pin to a specific commit SHA or tag instead:

- "bigbluebutton-html-plugin-sdk": "https://codeload.github.com/bigbluebutton/bigbluebutton-html-plugin-sdk/tar.gz/refs/pull/192/head",
+ "bigbluebutton-html-plugin-sdk": "https://codeload.github.com/bigbluebutton/bigbluebutton-html-plugin-sdk/tar.gz/<commit-sha>",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51a43f5 and a07e7ae.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • bigbluebutton-html5/package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-webrtc)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: ts-code-compilation
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (bbb-etherpad)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-config)
  • GitHub Check: build-package (bbb-export-annotations)
  • GitHub Check: build-package (bbb-learning-dashboard)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: ts-code-validation
  • GitHub Check: plugin-sdk-version-check

@antonbsa
antonbsa force-pushed the validate-test-variables branch from 266b21f to 82dfee9 Compare July 1, 2025 23:08
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2025

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 1, 2025

Copy link
Copy Markdown

Automated tests Summary

🚨 Test workflow has failed


Click here to check the action test reports (to view the report locally, see the docs)

@antonbsa

antonbsa commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

Closing this as #23388 implements the PR's changes

@antonbsa antonbsa closed this Jul 8, 2025
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.

1 participant