Skip to content

Commit

Permalink
Cleanup integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 28, 2024
1 parent 0940997 commit f4b0616
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 315 deletions.
7 changes: 1 addition & 6 deletions components/app/lib/call_platform/fake_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ def connect_ws_server_url

TEST_NUMBERS = [
TestNumber.new(number: "1111", twiml_response: "<Response><Say>Hello World!</Say><Hangup /></Response>"),
ConnectTestNumberWithTwiMLResponse.new(number: "2222"),
TestNumber.new(
number: "3333",
voice_url: ENV.fetch("CONNECT_VOICE_URL", "https://example.com/connect"),
voice_method: ENV.fetch("CONNECT_VOICE_METHOD", "POST")
)
ConnectTestNumberWithTwiMLResponse.new(number: "2222")
].freeze

def create_call(params)
Expand Down
14 changes: 0 additions & 14 deletions components/app/spec/lib/call_platform/fake_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ module CallPlatform
twiml: include("<Connect>")
)
end

it "returns a mock connect response via URL" do
client = FakeClient.new

response = client.create_call(
to: "3333",
from: "+855715200987"
)

expect(response).to have_attributes(
voice_url: "https://example.com/connect",
voice_method: "POST"
)
end
end

describe "#create_media_stream" do
Expand Down
1 change: 0 additions & 1 deletion components/testing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ RUN cd /testing/support/ws_server && \
EXPOSE 5060

ENV WS_SERVER_PORT "3001"
ENV WS_SERVER_AUDIO_OUTPUT "audio.raw"

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["start"]
3 changes: 1 addition & 2 deletions components/testing/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/sh

if [ "$1" = 'start' ]; then
WS_SERVER_AUDIO_OUTPUT="${WS_SERVER_AUDIO_OUTPUT:="audio.raw"}"
WS_SERVER_PORT="${WS_SERVER_PORT:="3001"}"

sipp -sf ./scenarios/uas.xml -bg -trace_msg
nohup node ./support/ws_server/test_server.js --port "$WS_SERVER_PORT" > ws-server.log &
nohup node ./support/ws_server/test_server.js --port "$WS_SERVER_PORT" > test-server.log &
tail -f /dev/null
fi

Expand Down
Binary file removed components/testing/scenarios/files/expected.wav
Binary file not shown.
6 changes: 3 additions & 3 deletions components/testing/support/ws_server/audio_test_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AudioTestStream {

if (ws) {
console.log(`${JSON.stringify(msg)}`)
ws.sendUTF(JSON.stringify(msg))
ws.send(JSON.stringify(msg))
}
}
}
Expand All @@ -35,7 +35,7 @@ class AudioTestStream {
const msg = this.makeMark()
if (ws) {
console.log(`${JSON.stringify(msg)}`)
ws.sendUTF(JSON.stringify(msg))
ws.send(JSON.stringify(msg))
}
}

Expand Down Expand Up @@ -64,4 +64,4 @@ class AudioTestStream {
}
}
}
module.exports = AudioTestStream
module.exports = AudioTestStream
Binary file removed components/testing/support/ws_server/files/taunt.wav
Binary file not shown.
175 changes: 0 additions & 175 deletions components/testing/support/ws_server/package-lock.json

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

1 change: 0 additions & 1 deletion components/testing/support/ws_server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"httpdispatcher": "^2.2.0",
"minimist": "^1.2.8",
"wavefile": "^11.0.0",
"websocket": "^1.0.34",
"ws": "^8.16.0"
}
}
18 changes: 15 additions & 3 deletions components/testing/support/ws_server/retell_server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
// Usage:
// Obtain Retell API key and Agent ID from https://www.retellai.com/
// Obtain your Somleng credentials from https://app.somleng.org
// $ node retell_server.js --api_key <retell-api-key> --agent_id <retell-agent-id> --port 3000
// $ ngrok http 3000
// $ curl -X "POST" "https://api.somleng.org/2010-04-01/Accounts/<AccountSID>/Calls.json" \
// -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
// -u '<AccountSID>:<AuthToken>' \
// --data-urlencode "Url=<ngrok-url>" \
// --data-urlencode "To=<destination-number>" \
// --data-urlencode "From=<from-number>"

var http = require("http");
var HttpDispatcher = require("httpdispatcher");
var assert = require('assert');

const argv = require("minimist")(process.argv.slice(2));
const httpPort = argv.port && parseInt(argv.port) ? parseInt(argv.port) : 8888;
const api_key = argv.api_key ? argv.api_key : null;
const agent_id = argv.agent_id ? argv.agent_id : null;
const httpPort = argv.port && parseInt(argv.port) ? parseInt(argv.port) : 3000;
const api_key = argv.api_key ? argv.api_key : null;
const agent_id = argv.agent_id ? argv.agent_id : null;

assert.ok(api_key, 'Retell api key not provided')
assert.ok(agent_id, 'Retell agent id not provided')
Expand Down
10 changes: 0 additions & 10 deletions components/testing/support/ws_server/templates/streams.xml

This file was deleted.

Loading

0 comments on commit f4b0616

Please sign in to comment.