Verified Commit 395e2a15 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

WIP

The idea behind this is to make container with reForis we can check
nsfarm.web.reforis classes against.
parent 16125541
#!/bin/bash
# nsfarm:base-alpine internet
##################################################################################
# Container used for testing reForis. We use this in selftests to verify that our
# page abstraction is well configured.
##################################################################################
set -e
# Make prepare script executable so we can later run it
chmod +x "/bin/install_reforis"
# Install utilities we need to install reForis
apk add sudo make curl git python3 py3-pip py3-virtualenv npm
apk add gcc cmake libc-dev libcap-dev python3-dev lua5.1-dev json-c-dev
cmake_install() {
local giturl="$1"
git clone "$giturl" cmakerepo
cd cmakerepo
cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX:PATH=/usr
make install
cd ..
rm -rf cmakerepo
}
cmake_install git://git.openwrt.org/project/libubox.git
cmake_install git://git.openwrt.org/project/uci.git
cmake_install https://gitlab.nic.cz/turris/ubus.git
#cmake_install https://gitlab.nic.cz/turris/libnl-tiny.git
#
#git clone git://git.openwrt.org/project/iwinfo.git
#cd iwinfo
#exit 0
#make FPIC="-fPIC" LDFLAGS="-lc" CFLAGS="-I /usr/include/libnl-tiny -D_GNU_SOURCE" BACKENDS="nl80211"
#cp -r include/* /usr/local/include/
#cp libiwinfo.so /usr/local/lib/
#cd ..
#rm -rf iwinfo
#
#cmake_install git://git.openwrt.org/project/rpcd.git
#!/bin/bash
set -eu
branch="${1:-}"
turrispackages="$(curl https://repo.turris.cz/$branch/omnia/packages/turrispackages/Packages)"
checkout() {
local package="$1"
if [ -z "$branch" ]; then
ref="$(git tag | grep '^v' | sort -V | tail -1)"
else
ref="v$(echo "$turrispackages" \
| awk -v pkg="^Package: $package$" '$0~pkg,/^$/ { if ($1 == "Version:") { gsub("-.*$","",$2); print $2 } }')"
fi
}
python_install() {
local package="$1"
local giturl="$2"
git clone "$giturl" "$package"
cd "$package"
checkout "$package"
pip install .
cd ..
rm -rf "$package"
}
#python_install turrishw https://gitlab.nic.cz/turris/turrishw.git
#python_install foris-schema https://gitlab.nic.cz/turris/foris-controller/foris-schema.git
python_install foris-controller https://gitlab.nic.cz/turris/foris-controller/foris-controller.git
python_install foris-client https://gitlab.nic.cz/turris/foris-controller/foris-client.git
# TODO we need fosquitto
git clone https://gitlab.nic.cz/turris/reforis/reforis.git
cd reforis
make install-js build-js install
"""This tests our page representation objects. We test that we can locate all elements.
"""
import pytest
from nsfarm.lxd import Container
@pytest.fixture(name="container", scope="module")
def fixture_container(lxd_connection):
"""Container with reForis development environment for testing.
"""
with Container(lxd_connection, "base-alpine", internet=True, strict=False) as container:
container.shell.run([
"git clone https://gitlab.nic.cz/turris/reforis/reforis.git",
"cd reforis",
])
yield container
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment