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

mdlsub: http source based fixture writer for subscribers #1154

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Conversation

j4k4
Copy link
Member

@j4k4 j4k4 commented Sep 23, 2024

closes #1152

This PR contains two major changes related to processing fixtures:

fixture groups

On adding fixtures sets to an application, one has to define the group into which the data belongs as the first argument. \

app := application.Default(
    application.WithFixtureSetFactory("default", fixtureSetsFactory),
)

The default group is loaded on default and can be defined in the config:

fixtures:
  enabled: true
  groups: ["default"]

subscriber fixture loading

The mdlsub contains a FixtureSetFactory now which enables fixture loading for subscribers via http endpoints.
On subscriber start the app will request the fixtures via http and persists the data into the configured outputs.

application.RunMdlSubscriber(
    subscribers.Transformers,
    application.WithFixtureSetFactory("subscriber", mdlsub.FixtureSetFactory(subscribers.Transformers)),
)

The source is set via config:

fixtures:
  enabled: true
  groups: ["subscriber"]
  providers:
    subscriber:
      host: http://fixtures.io
      path: /v0/fixtures/subscriber
      dataset_name: management

@j4k4 j4k4 force-pushed the mdlsub-fixtures branch 3 times, most recently from 0ab252a to e40e982 Compare September 26, 2024 14:06
pkg/fixtures/named.go Outdated Show resolved Hide resolved
pkg/fixtures/named.go Outdated Show resolved Hide resolved
pkg/mdlsub/config_postprocessor_subscriber.go Outdated Show resolved Hide resolved
pkg/mdlsub/fixtures.go Outdated Show resolved Hide resolved
pkg/mdlsub/fixtures.go Show resolved Hide resolved
pkg/mdlsub/settings.go Outdated Show resolved Hide resolved
pkg/mdlsub/subscriber_core.go Outdated Show resolved Hide resolved
pkg/mdlsub/subscriber_core.go Show resolved Hide resolved
pkg/mdlsub/subscriber_core.go Show resolved Hide resolved
pkg/refl/helpers.go Outdated Show resolved Hide resolved
pkg/mdlsub/subscriber_core.go Outdated Show resolved Hide resolved
@j4k4 j4k4 force-pushed the mdlsub-fixtures branch 6 times, most recently from 161399d to 847794d Compare October 1, 2024 10:24
@j4k4 j4k4 merged commit 2c08786 into main Oct 2, 2024
13 checks passed
@j4k4 j4k4 deleted the mdlsub-fixtures branch October 2, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http source based fixture writer for subscribers
2 participants