Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Jan 25, 2025
1 parent 1e951d9 commit d9891cc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
# spawning a script prints only a PID
./openc3.sh cli script spawn INST/procedures/checks.rb | grep -v "^\s*\d+\s*$"
# run a script that will fail and look for the failure message
./openc3.sh cli script run --wait 10 INST/procedures/checks.rb | tee /dev/tty | grep -q "script failed"
./openc3.sh cli script run --wait 20 INST/procedures/checks.rb | tee /dev/tty | grep -q "script failed"
# run a script that will complete successfully
./openc3.sh cli script run INST/procedures/stash.rb | tee /dev/tty | grep "script complete"
- name: openc3.sh util save,load
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
docker ps
docker logs cosmos-openc3-cosmos-init-1
docker logs cosmos-openc3-operator-1
docker logs cosmos-openc3-cosmos-cmd-tlm-api-1
docker logs cosmos-openc3-cosmos-script-runner-api-1
# Build a test plugin for playwright and a copy so we can 'upgrade'
- name: Build plugin
shell: 'script -q -e -c "bash {0}"'
Expand Down
7 changes: 6 additions & 1 deletion openc3-cosmos-cmd-tlm-api/spec/models/streaming_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ def response.is_truncated

@messages = []
@channel = double('channel')
allow(@channel).to receive(:transmit) { |msg| @messages << msg }
allow(@channel).to receive(:uuid).and_return("abc123")

allow(ActionCable.server).to receive(:broadcast) do |uuid, message|
@messages << message
end

@api = StreamingApi.new(123, @channel, scope: 'DEFAULT')
end

Expand Down
4 changes: 2 additions & 2 deletions openc3/lib/openc3/script/web_socket_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def initialize(url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeou
def generate_url
schema = ENV['OPENC3_API_SCHEMA'] || 'http'
hostname = ENV['OPENC3_API_HOSTNAME'] || (ENV['OPENC3_DEVEL'] ? '127.0.0.1' : 'openc3-cosmos-cmd-tlm-api')
port = ENV['OPENC3_API_PORT'] || '2901'
port = ENV['OPENC3_API_CABLE_PORT'] || ENV['OPENC3_API_PORT'] || '3901'
port = port.to_i
return "#{schema}://#{hostname}:#{port}/openc3-api/cable"
end
Expand All @@ -198,7 +198,7 @@ def initialize(url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeou
def generate_url
schema = ENV['OPENC3_SCRIPT_API_SCHEMA'] || 'http'
hostname = ENV['OPENC3_SCRIPT_API_HOSTNAME'] || (ENV['OPENC3_DEVEL'] ? '127.0.0.1' : 'openc3-cosmos-script-runner-api')
port = ENV['OPENC3_SCRIPT_API_PORT'] || '2902'
port = ENV['OPENC3_SCRIPT_API_CABLE_PORT'] || ENV['OPENC3_SCRIPT_API_PORT'] || '3902'
port = port.to_i
return "#{schema}://#{hostname}:#{port}/script-api/cable"
end
Expand Down
4 changes: 2 additions & 2 deletions openc3/python/openc3/script/web_socket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def generate_url(self):
hostname = os.environ.get("OPENC3_API_HOSTNAME") or (
"127.0.0.1" if os.environ.get("OPENC3_DEVEL") else "openc3-cosmos-cmd-tlm-api"
)
port = os.environ.get("OPENC3_API_PORT") or "2901"
port = os.environ.get("OPENC3_API_CABLE_PORT") or os.environ.get("OPENC3_API_PORT") or "3901"
port = int(port)
return f"{schema}://{hostname}:{port}/openc3-api/cable"

Expand Down Expand Up @@ -231,7 +231,7 @@ def generate_url(self):
hostname = os.environ.get("OPENC3_SCRIPT_API_HOSTNAME") or (
"127.0.0.1" if os.environ.get("OPENC3_DEVEL") else "openc3-cosmos-script-runner-api"
)
port = os.environ.get("OPENC3_SCRIPT_API_PORT") or "2902"
port = os.environ.get("OPENC3_SCRIPT_API_CABLE_PORT") or os.environ.get("OPENC3_SCRIPT_API_PORT") or "3902"
port = int(port)
return f"{schema}://{hostname}:{port}/script-api/cable"

Expand Down

0 comments on commit d9891cc

Please sign in to comment.