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

adding tmt #1

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7bf58a6
adding tmt
Lorquas Sep 13, 2023
344e354
removing manual trigger
Lorquas Sep 19, 2023
b19967c
using internal tf
Lorquas Sep 20, 2023
e890043
using internal tf
Lorquas Sep 20, 2023
c06d597
build: split spec file generation in own target
ptoscano Sep 21, 2023
ea7c132
build: split tarball generation in own target
ptoscano Sep 21, 2023
a17348a
build: drop unused replacement for spec file generation
ptoscano Sep 22, 2023
bfdd094
packit: try to do git builds
ptoscano Sep 21, 2023
7ac4b11
simple tmt test for version
ptoscano Sep 21, 2023
4a77dd6
initial integration test sample
ptoscano Sep 22, 2023
b1216e0
try to pick insights-client
ptoscano Sep 25, 2023
08cf6b6
Added an ansible playbook to deploy rhc tests
jstavel Oct 6, 2023
11e4842
removed ansible stuff - it is not required for simple workflow
jstavel Oct 9, 2023
3828c73
added test for disconnect
jstavel Oct 17, 2023
fcc149b
Merge branch 'packit' of github.com:Lorquas/rhc into packit
jstavel Oct 17, 2023
c6c8402
Added an ansible playbook to deploy rhc tests
jstavel Oct 6, 2023
0ad2a81
removed ansible stuff - it is not required for simple workflow
jstavel Oct 9, 2023
ff018fb
feat: all basic tests for rhc
jstavel Oct 26, 2023
1b3212e
feat: a test for inventory record
jstavel Oct 27, 2023
77686ea
feat: a test for tags in inventory
jstavel Oct 31, 2023
b4c8056
fix: Update testing matrix
jirihnidek Aug 22, 2023
4a1bf0f
build(deps): bump golang.org/x/sys
dependabot[bot] Aug 22, 2023
ac39596
fix: Fix issues of bash auto-complete script
jirihnidek Oct 2, 2023
2519b37
fix: insights connection status
ahitacat Oct 17, 2023
9db5d63
PEP8
Lorquas Nov 3, 2023
bf8e72b
adding pre-commit
Lorquas Nov 7, 2023
ae27bd1
fix: test.sh will use requirements.txt to install the whole python te…
jstavel Nov 15, 2023
2c9dc9a
fix: fixtures are returned by yield statement
jstavel Nov 15, 2023
1fd2f77
feat: fixture settings for Dynaconf to be available the pytest way
jstavel Nov 15, 2023
a13976f
Merge branch 'packit' of github.com:Lorquas/rhc into packit
jstavel Nov 15, 2023
d5aea8d
Merge branch 'RedHatInsights:packit' into packit
Archana-PandeyM Nov 21, 2023
8f09d3d
removed mqtt related fixture
jstavel Nov 21, 2023
e41f305
Merge branch 'packit' of github.com:Lorquas/rhc into packit
jstavel Nov 21, 2023
61b5fbf
fix: pre-commit issues fixed
jstavel Nov 22, 2023
fb01318
feat: rhc connecting using activation key
jstavel Nov 23, 2023
248ec0b
feat: rhc tests use fixture registered_system, not_registered_system …
jstavel Nov 24, 2023
2d132ef
feat: e2e tests uses registered_system and not_registered_system already
jstavel Nov 24, 2023
6c95c20
fix: removed unused dependencies
jstavel Nov 24, 2023
95579c8
feat: env pytest mark to specify a required dynaconf environment
jstavel Nov 27, 2023
0845ab3
fixed stdout verification
jstavel Jan 8, 2024
c80c118
added settings fixture, fixed a problem with stdout verification
jstavel Jan 8, 2024
02fc923
updated to use pytest-client-tools rather than conftest.py
jstavel Jan 10, 2024
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
37 changes: 16 additions & 21 deletions .copr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ spec ?= $(PWD)
SOURCEDIR := $(shell rpmbuild -E %_sourcedir)
SRCRPMDIR := $(shell rpmbuild -E %_srcrpmdir)

srpm: SHORTNAME = $(shell basename $(PWD))
srpm: LONGNAME = $(SHORTNAME)
srpm: BRANDNAME = $(SHORTNAME)
srpm: VERSION := $(shell echo $(VERSION) | awk -F. '{printf("%d.%d.%d", $$1, $$2, $$3+1)}')
srpm: RELEASE = $(shell printf "0.%s.git.%s" $(shell git rev-list $(shell git describe --tags --abbrev=0 --always | tr -d '\n')..HEAD --count | tr -d '\n') $(shell git rev-parse --short HEAD | tr -d '\n'))
srpm: PKGNAME = $(SHORTNAME)
SHORTNAME = $(shell basename $(PWD))
LONGNAME = $(SHORTNAME)
BRANDNAME = $(SHORTNAME)
VERSION := $(shell echo $(VERSION) | awk -F. '{printf("%d.%d.%d", $$1, $$2, $$3+1)}')
RELEASE = $(shell printf "0.%s.git.%s" $(shell git rev-list $(shell git describe --tags --abbrev=0 --always | tr -d '\n')..HEAD --count | tr -d '\n') $(shell git rev-parse --short HEAD | tr -d '\n'))
PKGNAME = $(SHORTNAME)

.PHONY: srpm
srpm: deps
mkdir -p $(SOURCEDIR)
mkdir -p $(SRCRPMDIR)
mkdir -p $(outdir)
.PHONY: srpm tarball
$(spec)/rhc.spec: $(spec)/.copr/rhc.spec.in
sed \
-e 's,[@]SHORTNAME[@],$(SHORTNAME),g' \
-e 's,[@]LONGNAME[@],$(LONGNAME),g' \
Expand All @@ -28,17 +25,15 @@ srpm: deps
-e 's,[@]TOPICPREFIX[@],$(TOPICPREFIX),g' \
-e 's,[@]DATAHOST[@],$(DATAHOST),g' \
-e 's,[@]PROVIDER[@],$(PROVIDER),g' \
-e 's,[@]PREFIX[@],$(PREFIX),g' \
-e 's,[@]BINDIR[@],$(BINDIR),g' \
-e 's,[@]SBINDIR[@],$(SBINDIR),g' \
-e 's,[@]LIBEXECDIR[@],$(LIBEXECDIR),g' \
-e 's,[@]DATAROOTDIR[@],$(DATAROOTDIR),g' \
-e 's,[@]DATADIR[@],$(DATADIR),g' \
-e 's,[@]SYSCONFDIR[@],$(SYSCONFDIR),g' \
-e 's,[@]LOCALSTATEDIR[@],$(LOCALSTATEDIR),g' \
-e 's,[@]DOCDIR[@],$(DOCDIR),g' \
$(spec)/.copr/rhc.spec.in > $(spec)/rhc.spec
$< > $@

tarball: $(spec)/rhc.spec
make PKGNAME=$(PKGNAME) VERSION=$(VERSION)-$(RELEASE) dist

srpm: $(spec)/rhc.spec tarball deps
mkdir -p $(SOURCEDIR)
mkdir -p $(SRCRPMDIR)
mkdir -p $(outdir)
install -D -m644 $(PKGNAME)-$(VERSION)-$(RELEASE).tar.gz $(SOURCEDIR)
spectool --get-files --source 1 --sourcedir $(spec)/rhc.spec
spectool --get-files --source 2 --sourcedir $(spec)/rhc.spec
Expand Down
11 changes: 7 additions & 4 deletions .copr/rhc.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ Source2: https://github.com/RedHatInsights/yggdrasil-worker-package-manager/rele

ExclusiveArch: %{go_arches}

%if %{defined rhel} && %{undefined centos}
Requires: insights-client
%endif

BuildRequires: git
#BuildRequires: git
BuildRequires: golang
BuildRequires: dbus-devel
BuildRequires: systemd-devel
BuildRequires: systemd


%description
Expand Down Expand Up @@ -56,7 +59,7 @@ make PREFIX=%{_prefix} \
cd %{_builddir}/%{name}/yggdrasil-worker-package-manager
go build -o rhc-package-manager-worker -mod=vendor .

cd %{_builddir}/%{name}/%{name}-%{version}-@RELEASE@
cd %{_builddir}/%{name}-%{version}-@RELEASE@/%{name}-%{version}-@RELEASE@
make PREFIX=%{_prefix} \
SYSCONFDIR=%{_sysconfdir} \
LOCALSTATEDIR=%{_localstatedir} \
Expand Down Expand Up @@ -90,7 +93,7 @@ cd %{_builddir}/%{name}/yggdrasil-worker-package-manager
install -D -m 755 rhc-package-manager-worker %{buildroot}%{_libexecdir}/@LONGNAME@/
install -D -m 644 config.toml %{buildroot}%{_sysconfdir}/@LONGNAME@/workers/rhc-package-manager.toml

cd %{_builddir}/%{name}/%{name}-%{version}-@RELEASE@
cd %{_builddir}/%{name}-%{version}-@RELEASE@/%{name}-%{version}-@RELEASE@
make PREFIX=%{_prefix} \
SYSCONFDIR=%{_sysconfdir} \
LOCALSTATEDIR=%{_localstatedir} \
Expand All @@ -106,7 +109,7 @@ make PREFIX=%{_prefix} \
install

%files
%doc %{name}-%{version}-@RELEASE@/README.md
#%doc %{name}-%{version}-@RELEASE@/README.md
%{_bindir}/@SHORTNAME@
%{_sbindir}/@SHORTNAME@d
%{_sysconfdir}/@LONGNAME@/
Expand Down
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
5 changes: 3 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Go

on:
"on":
push:
pull_request:

Expand All @@ -10,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.16", "1.18", "1.19"]
go: ["1.18", "1.19", "1.20"]
steps:
- name: Updating ...
run: sudo apt-get -qq update
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Lint

on: pull_request
"on": pull_request

jobs:
lint-commits:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

"on":
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,36 @@ BUILDROOT
RPMS
SOURCES
SRPMS

# Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Virtual environment
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Jetbrains
.idea/

# Vim
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Visual Studio Code
.vscode
51 changes: 51 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
# Default packit instance is a prod and only this is used
# stg instance is present for testing new packit features
# in forked repositories where stg is installed.
packit_instances: ["prod"]
upstream_project_url: https://github.com/Lorquas/rhc
specfile_path: rhc.spec
srpm_build_deps:
- git-core
- golang
- make

actions:
post-upstream-clone:
- bash -c "make -f .copr/Makefile tarball SHORTNAME=rhc"
create-archive:
- bash -c "ls -1t ./rhc*.tar.gz | head -n 1"

# issue_repository: https://github.com/strimzi/strimzi-kafka-operator
jobs:
- job: copr_build
trigger: pull_request
targets:
- centos-stream-9-x86_64
# - fedora-latest-stable

- job: tests
trigger: pull_request
# Suffix for job name
identifier: "unit"
targets:
# https://packit.dev/docs/configuration/#aliases
- centos-stream-9-x86_64
# - fedora-latest-stable
# manual_trigger: true
labels:
- unit

# - job: tests
# trigger: pull_request
# # Suffix for job name
# identifier: "unit"
# use_internal_tf: True
# # http://storage.tft.osci.redhat.com/composes-production.html
# targets:
# centos-stream-9-x86_64:
# distros: [RHEL-9.3.0-Nightly]
# centos-stream-8-x86_64:
# distros: [RHEL-8-Updated]
# labels:
# - unit
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
repos:
- repo: https://github.com/hhatto/autopep8
rev: 'v2.0.4'
hooks:
- id: autopep8

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- id: yamllint

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.1
hooks:
- id: ruff
args:
- '--fix'
- '--show-fixes'

- repo: https://github.com/teemtee/tmt.git
rev: 1.28.2
hooks:
- id: tmt-lint
additional_dependencies:
# Make sure we use fmf compatible with tmt
# in the repo, not the 1.26.0 version.
- "fmf>=1.3.0"
- pint==0.20
52 changes: 52 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
- id: tmt-lint
name: tmt lint
entry: |
bash -c "git ls-files --error-unmatch \
$(python3 -c 'import tmt; print(tmt.Tree(logger=tmt.Logger.create(), \
path=\".\").root)')/.fmf/version && \
tmt lint --failed-only --source $@" PAD
files: '.*\.fmf$'
verbose: false
pass_filenames: true
language: python
language_version: python3

- id: tmt-tests-lint
name: tmt tests lint
entry: |
bash -c "git ls-files --error-unmatch \
$(python3 -c 'import tmt; print(tmt.Tree(logger=tmt.Logger.create(), \
path=\".\").root)')/.fmf/version && \
tmt tests lint --failed-only --source $@" PAD
files: '.*\.fmf$'
verbose: false
pass_filenames: true
language: python
language_version: python3

- id: tmt-plans-lint
name: tmt plans lint
entry: |
bash -c "git ls-files --error-unmatch \
$(python3 -c 'import tmt; print(tmt.Tree(logger=tmt.Logger.create(), \
path=\".\").root)')/.fmf/version && \
tmt plans lint --failed-only --source $@" PAD
files: '.*\.fmf$'
verbose: false
pass_filenames: true
language: python
language_version: python3

- id: tmt-stories-lint
name: tmt stories lint
entry: |
bash -c "git ls-files --error-unmatch \
$(python3 -c 'import tmt; print(tmt.Tree(logger=tmt.Logger.create(), \
path=\".\").root)')/.fmf/version && \
tmt stories lint --failed-only --source $@" PAD
files: '.*\.fmf$'
verbose: false
pass_filenames: true
language: python
language_version: python3
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DESTDIR ?=
SYSTEMD_SYSTEM_UNIT_DIR := $(shell pkg-config --variable systemdsystemunitdir systemd)

# Build flags
LDFLAGS :=
LDFLAGS :=
LDFLAGS += -X 'main.Version=$(VERSION)'
LDFLAGS += -X 'main.ShortName=$(SHORTNAME)'
LDFLAGS += -X 'main.LongName=$(LONGNAME)'
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ require (
github.com/google/go-cmp v0.5.6
github.com/google/uuid v1.1.2
github.com/urfave/cli/v2 v2.3.0
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
golang.org/x/sys v0.1.0
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
)
10 changes: 3 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand All @@ -30,20 +29,17 @@ github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/subpop/go-ini v0.1.4 h1:+OVDOLyoQQCkk36v48bDcBscw2GCn9cesQc6PFLYdg8=
github.com/subpop/go-ini v0.1.4/go.mod h1:q0fhdlbGE3dI9dHPgUntXh1ggwR+SpfXL/kogOefaBE=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Loading
Loading