Commit graph

12 commits

Author SHA1 Message Date
Brian C. Lane
a47375a10d Rename gpgkey_urls to gpgkeys
This has never been supported in osbuild-composer, so it is safe to
rename in preparation for adding repo metadata gpg signature checking.
2023-02-01 10:27:58 +01:00
Martin Sehnoutka
b950d6e062 weldr: accept rhsm parameter in sources
The system sources allow specification of the rhsm parameter, but it
isn't available in the sources configured over the Weldr API. This patch
implements support for it.
2021-07-27 15:39:36 +02:00
Brian C. Lane
3e510ffc99 test: Add tests for trying to override a system source repo
This add tests to client and weldr to make sure that overriding an
existing system source repo returns an error.

Related: rhbz#1915359
2021-01-29 08:25:23 -08:00
Brian C. Lane
e37b513560 weldr: Add check for deleting system sources
It was passing it through to the non-system delete function
and not returning an error. This checks for system repos first and
returns a 400, SystemSource error response if it is in the system list.
2020-06-03 21:24:47 +02:00
Brian C. Lane
37258803b4 weldr: Add support for the v1 API to /projects/source/delete
This changes store.DeleteSource to DeleteSourceByName for v0 use and
DeleteSourceByID for v1 usage.

It includes a new client function DeleteSourceV1, adds a new test, and
converts the tests for the previous Source V1 API commits to use
DeleteSourceV1.
2020-06-03 21:24:47 +02:00
Brian C. Lane
982d292a96 weldr: Update projects/source/info to support API v1
This commit changes the store.GetAllSources to distinguish between
getting the source by the Name field, or by the ID (the key to the map)
using GetAllSourcesByName and ...ByID.

SourceConfig.RepoConfig() now takes an id parameter because SourceConfig
only stores the Name, not the ID.

In weldr I split the sourceInfoHandler into 2 separate functions for v0
and v1 behavior, with the core of the old function refactored as
getSourceConfigs and used by both of them.

This also adds new structs for the SourceResponseV0 and SourceResponseV1
as well as helper functions for converting to/from store.SourceConfig
2020-06-03 21:24:47 +02:00
Brian C. Lane
ddd2010815 weldr: Add support for the v1 API to /projects/source/new
This commit changes the store.PushSource function to take the key as
well as the SourceConfig so that it can be used for v0 or v1.

It adds helper functions for decoding the toml/json into a new
SourceConfig interface type which lets the core source/new code be
shared between the versions.

It also adds tests for the new API behavior.
2020-06-03 21:24:47 +02:00
Brian C. Lane
55325a8549 weldr: Add API v1 support to source listing
This is the first patch in a series to add APIv1 support to the
/projects/source routes. The change involves using the store.Sources key
in a different way (as an id instead of as a duplicate of the struct's
Name field) but does not actually involve changing the Sources json in
the store.

In the V0 API the name of the source was used as the identifier, and
there was no short id. In V1 the source is identified by the API using
a short id, and the Name is just a field in the struct to describe the
source. This will become more obvious with the /projects/source/info
response.

This commit changes the following:

Changes store.ListSources to ListSourcesByName and explicitly pulls the
name from the source struct instead of the key. v0 will use this
function call.

Adds store.ListSourcesById which returns the source key as the
identifier. This is used by v1.

Adds a new weldr.SourcesListV1 response type, even though it is exactly
the same as the V1 response in this specific case. I thought it would be
better to have one called V1 than to reuse the V0 struct and possibly
confuse people.

The /projects/source/list API now lists the sources by name for v0 and id for v1.

A test has been added. You will notice it still uses v0 to push and
delete the sources. These will be updated when the new version of the
functions are added in subsequent commits.
2020-06-03 21:24:47 +02:00
Alexander Todorov
bd4793eb58 tests: verify system-wide sources can't be deleted. Closes #315
make sure this test can be run both as a unit test and as an
integration test on a running system
2020-04-06 19:49:23 +02:00
Alexander Todorov
a1eb6b4cd5 tests: verify user defined sources can be deleted. Refs #315 2020-04-06 19:49:23 +02:00
Brian C. Lane
0eb3bfe89a weldr: Adding sources with empty name should return an error
Currently, if a TOML source is added with no name, or the source is
incorrectly inside a [section] it will add an empty source, causing
depsolving to crash.

This adds tests for 'name' and 'type' fields as a minimum requirement,
and returns an API error if they are empty or missing.

This also includes unit and integration tests.

Closes PR#462
2020-04-06 19:34:37 +02:00
Brian C. Lane
856eb59edf client: Move the weldrcheck integration tests to client
With this change the integration tests can now also be run as unit tests
against the mocked server. The way it works is this:

internal/client/unit_test.go sets up the mock server and is built
when the `integration` build tag is *not* included.

internal/client/integration_test.go sets up the connection to an
existing server and is built when the `integration` build tag *is*
included.

The test code is built and run for both cases.

Currently they all pass for the integration test run. The unit test
cases need some work because the mocked server isn't a real server with
real depsolving and package lists. A future commit will fix this.
2020-03-27 19:07:33 +01:00
Renamed from internal/weldrcheck/source_test.go (Browse further)