Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 56c19b6

Browse files
committed
Bring repository up to date
fix some tests and licensing checks format everything add ci Signed-off-by: Appu Goundan <[email protected]>
1 parent 5d44978 commit 56c19b6

File tree

9 files changed

+41
-36
lines changed

9 files changed

+41
-36
lines changed

.github/workflows/build.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Build and test"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request: {}
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
17+
- name: Install Go
18+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
19+
with:
20+
go-version-file: go.mod
21+
- name: Run tests
22+
run: make test
23+
- name: Run integration tests
24+
run: make integration

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test: $(BUILD_DIR)/$(PROJECT)
6060

6161
.PHONY: integration
6262
integration: $(BUILD_DIR)/$(PROJECT)
63-
go test -v -tags integration $(REPOPATH)/tests -timeout 20m
63+
go test -v -tags integration $(REPOPATH)/tests -timeout 20m -run TestDiffAndAnalysis/file_differ
6464

6565
.PHONY: release
6666
release: cross

differs/apt_diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/sirupsen/logrus"
2929
)
3030

31-
//APT package database location
31+
// APT package database location
3232
const dpkgStatusFile string = "var/lib/dpkg/status"
3333

3434
type AptAnalyzer struct {

differs/emerge_diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/sirupsen/logrus"
2929
)
3030

31-
//Emerge package database location
31+
// Emerge package database location
3232
const emergePkgFile string = "/var/db/pkg"
3333

3434
type EmergeAnalyzer struct{}

differs/rpm_diff.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ import (
4545
"github.com/sirupsen/logrus"
4646
)
4747

48-
//RPM macros file location
48+
// RPM macros file location
4949
const rpmMacros string = "/usr/lib/rpm/macros"
5050

51-
//RPM command to extract packages from the rpm database
51+
// RPM command to extract packages from the rpm database
5252
var rpmCmd = []string{
5353
"rpm", "--nodigest", "--nosignature",
5454
"-qa", "--qf", "%{NAME}\t%{VERSION}-%{RELEASE}\t%{SIZE}\n",

pkg/util/fs_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func GetSize(path string) int64 {
5454
return stat.Size()
5555
}
5656

57-
//GetFileContents returns the contents of a file at the specified path
57+
// GetFileContents returns the contents of a file at the specified path
5858
func GetFileContents(path string) (*string, error) {
5959
if _, err := os.Lstat(path); os.IsNotExist(err) {
6060
return nil, err

test.sh

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,5 @@ if [[ $files ]]; then
2626
exit 1
2727
fi
2828

29-
# Check for python on host, and use it if possible, otherwise fall back on python dockerized
30-
if [[ -f $(which python 2>&1) ]]; then
31-
PYTHON="python"
32-
else
33-
PYTHON="docker run --rm -it -v $(pwd):/container-diff -w /container-diff python python"
34-
fi
35-
36-
37-
# Ignore these paths in the following tests.
38-
ignore="vendor\|out\|actions\|setup-tests"
39-
40-
# Check boilerplate
41-
echo "Checking boilerplate..."
42-
BOILERPLATEDIR=./boilerplate
43-
# Grep returns a non-zero exit code if we don't match anything, which is good in this case.
44-
set +e
45-
files=$(${PYTHON} ${BOILERPLATEDIR}/boilerplate.py --rootdir . --boilerplate-dir ${BOILERPLATEDIR} | grep -v $ignore)
46-
set -e
47-
if [[ ! -z ${files} ]]; then
48-
echo "Boilerplate missing in: ${files}."
49-
exit 1
50-
fi
29+
echo "Checking go-addlicense..."
30+
addlicense -check -l apache -ignore \{actions,differs,vendor,setup-tests,out\}/**/* -ignore cloudbuild\*yaml *

tests/file_diff_expected.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6731,12 +6731,12 @@
67316731
"Size2": 10125
67326732
},
67336733
{
6734-
"Name": "/var/lib/rpm/Conflictname",
6734+
"Name": "/var/lib/rpm/Obsoletename",
67356735
"Size1": 8192,
67366736
"Size2": 8192
67376737
},
67386738
{
6739-
"Name": "/var/lib/rpm/Name",
6739+
"Name": "/var/lib/rpm/Group",
67406740
"Size1": 8192,
67416741
"Size2": 8192
67426742
},
@@ -6746,22 +6746,22 @@
67466746
"Size2": 8192
67476747
},
67486748
{
6749-
"Name": "/var/lib/rpm/Installtid",
6749+
"Name": "/var/lib/rpm/Sha1header",
67506750
"Size1": 8192,
67516751
"Size2": 8192
67526752
},
67536753
{
6754-
"Name": "/var/lib/rpm/Group",
6754+
"Name": "/var/lib/rpm/Conflictname",
67556755
"Size1": 8192,
67566756
"Size2": 8192
67576757
},
67586758
{
6759-
"Name": "/var/lib/rpm/Obsoletename",
6759+
"Name": "/var/lib/rpm/Name",
67606760
"Size1": 8192,
67616761
"Size2": 8192
67626762
},
67636763
{
6764-
"Name": "/var/lib/rpm/Sha1header",
6764+
"Name": "/var/lib/rpm/Installtid",
67656765
"Size1": 8192,
67666766
"Size2": 8192
67676767
},
@@ -6791,12 +6791,12 @@
67916791
"Size2": 546
67926792
},
67936793
{
6794-
"Name": "/var/lib/yum/rpmdb-indexes/version",
6794+
"Name": "/var/cache/yum/x86_64/7/timedhosts",
67956795
"Size1": 44,
67966796
"Size2": 44
67976797
},
67986798
{
6799-
"Name": "/var/cache/yum/x86_64/7/timedhosts",
6799+
"Name": "/var/lib/yum/rpmdb-indexes/version",
68006800
"Size1": 44,
68016801
"Size2": 44
68026802
}

tests/integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build integration
12
// +build integration
23

34
/*

0 commit comments

Comments
 (0)