Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add livestream channel clip samples and tests #4449

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

irataxy
Copy link
Contributor

@irataxy irataxy commented Oct 25, 2024

Fixes b:341726237

Important: FFmpeg (https://www.ffmpeg.org/) must be installed in the test environment.

sudo apt install ffmpeg

Checklist

@irataxy irataxy requested review from a team as code owners October 25, 2024 01:52
Copy link

snippet-bot bot commented Oct 25, 2024

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Oct 25, 2024
r.Errorf("createChannelClip got err: %v", err)
}
if got := buf.String(); !strings.Contains(got, clipName) {
r.Errorf("createChannelClip got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, clipName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I'd prefer to not have the test output formatted in this way. It makes it harder to read on GitHub.

The test input can be as simple as:

r.Errorf("createChannelClip: want: %v, got %v", clipName, got)

@@ -517,6 +525,64 @@ func TestChannelEvents(t *testing.T) {
}
})

// Tests for clips
// Send a test stream for the clip.
cmd := exec.Command("ffmpeg", "-re", "-f", "lavfi", "-t", "45", "-i",
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue: I have concerns about running arbitrary processes from within tests. @muncus PTAL.

  1. Let's isolate this test into its own file. I want to keep this test hermeneutically sealed from other tests as best as possible.
  2. What exactly is the point of executing this command? The bytes returned from the output are thrown away.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IIUC, this command is generating a video stream. Can we do this with a static file instead?
I'd prefer to avoid adding ffmpeg to our testing images, as it has a history of vulnerabilities and could increase ongoing maintenance requirements.

@telpirion telpirion self-assigned this Oct 31, 2024
@telpirion telpirion added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 31, 2024
@irataxy irataxy marked this pull request as draft October 31, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Indicates a pull request not ready for merge, due to either quality or timing. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants