Skip to content
Snippets Groups Projects
Verified Commit 5a1d8426 authored by Ole Binder's avatar Ole Binder
Browse files

Fix: adjust tests to new config

parent e76e2d13
No related branches found
No related tags found
1 merge request!17Yaml configuration file
Pipeline #8466 passed
...@@ -25,6 +25,7 @@ RUN mkdir -p /srv/src /srv/tests /srv/config srv/logs srv/socket /var/audio ...@@ -25,6 +25,7 @@ RUN mkdir -p /srv/src /srv/tests /srv/config srv/logs srv/socket /var/audio
COPY src /srv/src COPY src /srv/src
COPY tests /srv/tests COPY tests /srv/tests
COPY config/pipewire/client.conf /etc/pipewire/pipewire.conf COPY config/pipewire/client.conf /etc/pipewire/pipewire.conf
COPY config/sample-engine-core.yaml /srv/tests/test-engine-core.yaml
COPY Makefile /srv/Makefile COPY Makefile /srv/Makefile
COPY VERSION /srv/VERSION COPY VERSION /srv/VERSION
COPY scripts/entrypoint.sh /srv/entrypoint.sh COPY scripts/entrypoint.sh /srv/entrypoint.sh
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "../src/settings.liq"
settings.init.allow_root.set(true) settings.init.allow_root.set(true)
settings.init.catch_exn.set(false) settings.init.catch_exn.set(false)
settings.server.timeout.set(180.) settings.server.timeout.set(180.)
...@@ -30,13 +29,64 @@ settings.log.level.set(1) ...@@ -30,13 +29,64 @@ settings.log.level.set(1)
# Engine Defaults # Engine Defaults
engine_meta_key_show_id = "show_id" let yaml.parse (config :
ignore(engine_meta_key_show_id) {
engine_default_track_type = "0" general: {
ignore(engine_default_track_type) engine_id: string,
socket_dir: string,
log_dir: string,
log_level: string,
liquidsoap_as_root: bool,
liquidsoap_min_version: string,
api_url_playlog: string,
input_stream_max_buffer: float,
input_stream_timeout: float,
playlist_folder: string,
meta_key_show_id: string,
default_track_type: string
},
telnet: {
server_enable: bool,
server_timeout: float,
server_host: string,
server_port: float
},
fallback: {
music_folder: string,
show_name: string,
show_id: string,
type: string,
music_playlist: string,
music_folder_reload: float,
max_blank: float,
min_noise: float,
threshold: float
},
stream: [
{
enabled: bool,
encoding: string,
bitrate: string,
channels: string,
host: string,
port: float,
mountpoint: string,
user: string,
password: string,
url: string,
name: string,
genre: string,
description: string
}
],
audio: {
soundsystem: string,
devices: {output: [{name: string}], input: [{name: string}]}
}
}
) = file.contents("test-engine-core.yaml")
# Assertions # Assertions
assertEqualsError = error.register("AssertEqualsError") assertEqualsError = error.register("AssertEqualsError")
def assertEquals(var1, var2) = def assertEquals(var1, var2) =
if if
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Engine Core Test Suite # Engine Core Test Suite
# #
# Only include tests which can be executed in a CI/CD pipeline # Only include tests which can be executed in a CI/CD pipeline
...@@ -28,6 +26,7 @@ ...@@ -28,6 +26,7 @@
%include "test_eval_source_type.liq" %include "test_eval_source_type.liq"
%include "test_eval_track_type.liq" %include "test_eval_track_type.liq"
%include "test_parse_json.liq" %include "test_parse_json.liq"
%include "test_metadata_file.liq"
# %include "test_metadata_file.liq"
%include "test_metadata_duration.liq" %include "test_metadata_duration.liq"
%include "test_metadata_build.liq" %include "test_metadata_build.liq"
\ No newline at end of file
...@@ -18,18 +18,7 @@ ...@@ -18,18 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "base_config.liq" %include "base_config.liq"
%include "../src/readini.liq"
# debug := true # debug := true
config = "../config/sample-production.engine-core.ini"
print(
"Config file used: #{config}"
)
ini = read_ini(config)
log(
"Read configuration:\n#{ini}"
)
# print(ini)
soundsystem = list.assoc(default="", "soundsystem", ini) assertEquals(config.audio.soundsystem, "jack")
assertEquals(soundsystem, "jack")
...@@ -17,18 +17,12 @@ ...@@ -17,18 +17,12 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "base_config.liq" %include "base_config.liq"
# Init defaults
engine_default_track_type = "0"
%include "../src/functions.liq" %include "../src/functions.liq"
### TEST ### ### TEST ###
# Case 1: Fallback # Case 1: Fallback
type = eval_source_type("fallback_folder") type = eval_source_type("fallback_folder")
assertEquals(type, "fallback") assertEquals(type, "fallback")
......
...@@ -17,18 +17,12 @@ ...@@ -17,18 +17,12 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "base_config.liq" %include "base_config.liq"
# Init defaults
engine_default_track_type = "0"
%include "../src/functions.liq" %include "../src/functions.liq"
### TEST ### ### TEST ###
# Case 1: Passed meta track type => 33 # Case 1: Passed meta track type => 33
type = eval_track_type("33", "fallback_playlist") type = eval_track_type("33", "fallback_playlist")
assertEquals(type, "33") assertEquals(type, "33")
......
...@@ -17,16 +17,15 @@ ...@@ -17,16 +17,15 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "base_config.liq" %include "base_config.liq"
settings.frame.audio.samplerate.set(44100) settings.frame.audio.samplerate.set(44100)
# Metadata on file # Metadata on file
input_fs = single(id="fs", "assets/audio.mp3") input_fs = single(id="fs", "assets/audio.mp3")
def process(metadata) = def process(metadata) =
# print(json.stringify(metadata)) # print(json.stringify(metadata))
assertEquals(metadata["album"], "ccMixter") assertEquals(metadata["album"], "ccMixter")
shutdown(code=0) shutdown(code=0)
end end
input_fs.on_metadata(process) input_fs.on_metadata(process)
output.dummy(id="dummy", input_fs) output.dummy(id="dummy", input_fs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment