Skip to content

Commit

Permalink
feat: add transcoder tests
Browse files Browse the repository at this point in the history
This commit adds some very basic tests for the transcoder so that we can
confirm that the transcoder is working correctly.

partially works on #86 point 2
  • Loading branch information
TroyKomodo committed May 31, 2023
1 parent c91422f commit f5c2914
Show file tree
Hide file tree
Showing 11 changed files with 608 additions and 120 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/player/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ yarn.lock
pkg/
target/
dist/
demo-dist/
3 changes: 2 additions & 1 deletion frontend/player/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ yarn.lock
wasm.d.ts
target/
dist/
pkg/
demo-dist/
pkg/
4 changes: 2 additions & 2 deletions video/ingest/src/ingest/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl Connection {
api_update_failed = true;
false
}
event = self.transcoder_req_rx.recv() => self.on_transcoder_request(&update_channel, &global, event.expect("transcoder closed")).await,
event = self.transcoder_req_rx.recv() => self.on_grpc_request(&update_channel, &global, event.expect("transcoder closed")).await,
} {}

if let Some(transcoder) = self.current_transcoder.take() {
Expand Down Expand Up @@ -451,7 +451,7 @@ impl Connection {
true
}

async fn on_transcoder_request(
async fn on_grpc_request(
&mut self,
update_channel: &mpsc::Sender<Vec<Update>>,
global: &Arc<GlobalState>,
Expand Down
2 changes: 2 additions & 0 deletions video/transcoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ dotenvy = "0"
portpicker = "0"
serial_test = "2"
tempfile = "3"
transmuxer = { path = "../transmuxer" }
flv = { path = "../container/flv" }
6 changes: 6 additions & 0 deletions video/transcoder/src/tests/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ pub async fn mock_global_state(config: AppConfig) -> (Arc<GlobalState>, Handler)
)
.expect("failed to create redis pool");

redis.connect();
redis
.wait_for_connect()
.await
.expect("failed to connect to redis");

let global = Arc::new(GlobalState::new(config, ctx, rmq, redis));

(global, handler)
Expand Down
Loading

0 comments on commit f5c2914

Please sign in to comment.