setup

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README ΒΆ

🌍 Language: πŸ‡©πŸ‡ͺ German β†’

Codeberg Release

GSF-NexFact-Logo GSF-NexFact-Assets
A dedicated central test asset repository for the GSF-NexFact e-invoicing ecosystem.

GSF stands for Go Small Frameworks β€” minimalist tools for robust applications.


Repository

This project is developed and maintained on Codeberg.

Canonical repository:

https://codeberg.org/tiny-frameworks/nexfact-assets

GitHub is an automated mirror of the Codeberg repository:

GitHub mirror:

https://github.com/tiny-frameworks/nexfact-assets


GSF-NexFact-Assets

GSF-nexfact-assets is the dedicated central test asset repository for the GSF-nexfact e-invoicing ecosystem. It stores shared test environments (env), reference resources (schemas, templates, mock profiles), and sample invoice files used across nexfact, nexfact-server, and related microservices.

By isolating heavy binary test fixtures into this repository, core source repositories (nexfact, nexfact-server, nexutils) remain lightweight and fast to clone.

This project is part of the tiny-frameworks initiative.


Directory Structure

nexfact-assets/
β”œβ”€β”€ setup.go             # Creates isolated working directory & free dynamic ports
β”œβ”€β”€ env/                 # Reference nexfact environment templates & schemas
└── testdata/
    └── resources/       # Test input files (PDFs, XMLs, JSON payloads, images)
        β”œβ”€β”€ test_generate_fx.json
        β”œβ”€β”€ test_combine_invoice.pdf
        β”œβ”€β”€ test_combine_invoice.xml
        └── test_attachment.png


Test Execution & Isolation Pattern

To guarantee that tests remain strictly deterministic and side-effect-free, tests must never write directly to this asset repository.

Instead, tests follow the TempDir Isolation Pattern:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      nexfact-assets       β”‚ (Read-Only Master Templates & Fixtures)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚ 1. Copy on Test Startup
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        tempDir            β”‚ (Isolated Temporary Working Directory)
β”‚  β”œβ”€β”€ env/                 β”‚
β”‚  └── resources/           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚ 2. Process, Write Output & Assert
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     os.RemoveAll()        β”‚ (Manual/Deferred Cleanup by Caller)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


Usage in Tests

import "codeberg.org/tiny-frameworks/nexfact-assets"

func TestMyServer(t *testing.T) {
    setupMap, err := assets.SetupTestEnv("native")
    if err != nil {
        t.Fatalf("failed to create testSetup: %v", err)
    }

    envRoot := setupMap["envRoot"]
    resourcePath := setupMap["resourcePath"]
    tempDir := setupMap["tempDir"]
    defer os.RemoveAll(tempDir)

    // ... execute tests ...
}


Local Development

This repository is designed to be used alongside related tiny-frameworks modules (nexfact, nexfact-server, nexutils).

For local development, place the repositories side-by-side in a shared workspace directory.


Organization & Standards

  • Copyright: Β© 2026 Georg Hagn.
  • Repository: codeberg.org/tiny-frameworks/nexfact-assets
  • License: Apache License, Version 2.0.

GSF-NexFact-Assets is an independent open-source project and is not affiliated with any corporation of a similar name.


Contact & Support

For inquiries, architectural discussions, or security issues, please contact:

πŸ“§ georghagn [at] tiny-frameworks.io


Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func ForceRemoveWatcherContainer ΒΆ

func ForceRemoveWatcherContainer()

func GetFreeAddr ΒΆ

func GetFreeAddr() (string, error)

Helper function: Finds a free port for isolated tests.

func IsContainerRunning ΒΆ

func IsContainerRunning(containerName string) bool

func SetupTestEnv ΒΆ

func SetupTestEnv(provider string) (map[string]string, error)

SetupTestEnv copies the central testdata directory into a temporary directory in isolation. func SetupTestEnv(provider string) (env, resources string) {

Types ΒΆ

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL