Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feedback_pipeline test that checks bash repotest workload #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from registry.fedoraproject.org/fedora:37

run dnf -y update fedora-gpg-keys && \
dnf -y install git python3-jinja2 python3-koji python3-yaml && \
dnf -y install git python3-pytest python3-pytest-cov python3-jinja2 python3-koji python3-yaml && \
dnf clean all

workdir /workspace
Expand Down
8 changes: 4 additions & 4 deletions feedback_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def datetime_now_string():
return datetime.datetime.now().strftime("%m/%d/%Y, %H:%M:%S")


def load_settings():
def load_settings(argv=None):
settings = {}

parser = argparse.ArgumentParser()
Expand All @@ -159,7 +159,7 @@ def load_settings():
parser.add_argument("--use-cache", dest="use_cache", action='store_true', help="Use local data instead of pulling Content Resolver. Saves a lot of time! Needs a 'cache_data.json' file at the same location as the script is at.")
parser.add_argument("--dev-buildroot", dest="dev_buildroot", action='store_true', help="Buildroot grows pretty quickly. Use a fake one for development.")
parser.add_argument("--dnf-cache-dir", dest="dnf_cache_dir_override", help="Override the dnf cache_dir.")
args = parser.parse_args()
args = parser.parse_args(argv)

settings["configs"] = args.configs
settings["output"] = args.output
Expand Down Expand Up @@ -7245,7 +7245,7 @@ def generate_historic_data(query):
###############################################################################


def main():
def main(argv=None):

# -------------------------------------------------
# Stage 1: Data collection and analysis using DNF
Expand All @@ -7254,7 +7254,7 @@ def main():
# measuring time of execution
time_started = datetime_now_string()

settings = load_settings()
settings = load_settings(argv)

settings["global_refresh_time_started"] = datetime.datetime.now().strftime("%-d %B %Y %H:%M UTC")

Expand Down
76 changes: 76 additions & 0 deletions test_configs/base-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
# This configuration file defines an "Environment" in Feedback Pipeline.
# https://tiny.distro.builders
#
# Environments influence how a workload looks like when installed.
# That's achieved by including specific packages — like coreutils-single — that
# influence the result.
# Environments can also act as base images when monitoring container sizes.

document: feedback-pipeline-environment
version: 1
data:
# id is the filename — that automatically prevents collisions for free!


### MANDATORY FIELDS ###

# Name is an identifier for humans
#
# (mandatory field)
name: Test F34 Environment

# A short description, perhaps hinting the purpose
#
# (mandatory field)
description: A base environment on top of which all test workloads are analyzed.

# Who maintains it? This is just a freeform string
# for humans to read. In Fedora, a FAS nick is recommended.
#
# (mandatory field)
maintainer: asamalik

# Different instances of the environment, one per repository.
#
# (mandatory field)
repositories:
- repo-test

# Packages defining this environment.
# This list includes packages for all
# architectures — that's the one to use by default.
#
# (mandatory field)
packages:
- fedora-repos-eln
AdamSaleh marked this conversation as resolved.
Show resolved Hide resolved
- fedora-release-eln

# Labels connect things together.
# Workloads get installed in environments with the same label.
# They also get included in views with the same label.
#
# (mandatory field)
labels:
- eln
AdamSaleh marked this conversation as resolved.
Show resolved Hide resolved
- eln-but-not-included
- eln-extras

### OPTIONAL FIELDS ###

# Architecture-specific packages.
#
# (optional field)
#arch_packages:
# x86_64:
# - arch-specific-package

# Extra installation options.
# The following are now supported:
# - "include-docs" - include documentation packages
# - "include-weak-deps" - automatically pull in "recommends" weak dependencies
#
# (optional field)
#options:
#- option

13 changes: 13 additions & 0 deletions test_configs/view-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
document: feedback-pipeline-compose-view
version: 1
data:
name: Test Package Set
description: Test package set based on F34
maintainer: bakery
labels:
- eln
AdamSaleh marked this conversation as resolved.
Show resolved Hide resolved
repository: repo-test
buildroot_strategy: dep_tracker


98 changes: 96 additions & 2 deletions test_feedback_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,99 @@

import feedback_pipeline

def test_build_completion():
assert 1 == 1
import json
import os
import pytest
import tempfile

from shutil import rmtree

@pytest.fixture(scope="module")
def feedback_pipeline_output():
with tempfile.TemporaryDirectory() as tmp:
os.mkdir(f"{tmp}/history")
feedback_pipeline.main([
"--dev-buildroot", "--dnf-cache-dir",
"/tmp/test_cr", "test_configs", tmp])
yield tmp


def test_bash_test_repo_workload(feedback_pipeline_output):
expected_pkg_added_ids = set([
'filesystem-3.14-5.fc34.aarch64',
'glibc-minimal-langpack-2.33-5.fc34.aarch64',
'tzdata-2021a-1.fc34.noarch',
'basesystem-11-11.fc34.noarch',
'bash-5.1.0-2.fc34.aarch64',
'ncurses-libs-6.2-4.20200222.fc34.aarch64',
'ncurses-base-6.2-4.20200222.fc34.noarch',
'libgcc-11.0.1-0.3.fc34.aarch64',
'glibc-2.33-5.fc34.aarch64',
'setup-2.13.7-3.fc34.noarch',
'glibc-common-2.33-5.fc34.aarch64'
])

with open(f"{feedback_pipeline_output}/workload--bash--base-test--repo-test--aarch64.json") as w:
workload = json.load(w)
assert set(workload["data"]["pkg_added_ids"]) == expected_pkg_added_ids

def test_bash_test_repo_view(feedback_pipeline_output):
expected_pkgs = {'alternatives-1.15-2.fc34',
'basesystem-11-11.fc34',
'bash-5.1.0-2.fc34',
'ca-certificates-2020.2.41-7.fc34',
'coreutils-8.32-21.fc34',
'coreutils-common-8.32-21.fc34',
'crypto-policies-20210213-1.git5c710c0.fc34',
'fedora-gpg-keys-34-1',
'fedora-release-34-1',
'fedora-release-common-34-1',
'fedora-release-identity-basic-34-1',
'fedora-repos-34-1',
'fedora-repos-eln-34-1',
'fedora-repos-rawhide-34-1',
'filesystem-3.14-5.fc34',
'gc-8.0.4-5.fc34',
'glibc-2.33-5.fc34',
'glibc-common-2.33-5.fc34',
'glibc-minimal-langpack-2.33-5.fc34',
'gmp-1:6.2.0-6.fc34',
'grep-3.6-2.fc34',
'guile22-2.2.7-2.fc34',
'libacl-2.3.1-1.fc34',
'libattr-2.5.1-1.fc34',
'libcap-2.48-2.fc34',
'libffi-3.1-28.fc34',
'libgcc-11.0.1-0.3.fc34',
'libselinux-3.2-1.fc34',
'libsepol-3.2-1.fc34',
'libstdc++-11.0.1-0.3.fc34',
'libtasn1-4.16.0-4.fc34',
'libtool-ltdl-2.4.6-40.fc34',
'libunistring-0.9.10-10.fc34',
'libxcrypt-4.4.18-1.fc34',
'make-1:4.3-5.fc34',
'ncurses-base-6.2-4.20200222.fc34',
'ncurses-libs-6.2-4.20200222.fc34',
'openssl-libs-1:1.1.1k-1.fc34',
'p11-kit-0.23.22-3.fc34',
'p11-kit-trust-0.23.22-3.fc34',
'pcre-8.44-3.fc34.1',
'pcre2-10.36-4.fc34',
'pcre2-syntax-10.36-4.fc34',
'pizza-package-000-placeholder',
'readline-8.1-2.fc34',
'sed-4.8-7.fc34',
'setup-2.13.7-3.fc34',
'tar-2:1.34-1.fc34',
'tzdata-2021a-1.fc34',
'zlib-1.2.11-26.fc34'}

with open(f"{feedback_pipeline_output}/view-packages--view-test.json") as w:
view = json.load(w)
assert set(view['pkgs'].keys()) == expected_pkgs



if __name__ == "__main__":
test_mock_argv()
AdamSaleh marked this conversation as resolved.
Show resolved Hide resolved