Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions bundler/bundler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const digitalOceanCommitID = "ed0958267922794ec8cf540e19131a2d9664bfc7"

func checkoutDigitalOceanRepo(t *testing.T) string {
t.Helper()
requireNetworkTests(t)

tmp := t.TempDir()
cmd := exec.Command("git", "clone", "https://github.com/digitalocean/openapi.git", tmp)
if err := cmd.Run(); err != nil {
Expand Down
16 changes: 16 additions & 0 deletions bundler/network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package bundler

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
6 changes: 6 additions & 0 deletions datamodel/high/v3/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ func TestAsanaAsDoc(t *testing.T) {
}

func TestDigitalOceanAsDocViaCheckout(t *testing.T) {
requireNetworkTests(t)

// this is a full checkout of the digitalocean API repo.
tmp := t.TempDir()
cmd := exec.Command("git", "clone", "https://github.com/digitalocean/openapi", tmp)
Expand Down Expand Up @@ -539,6 +541,8 @@ func TestDigitalOceanAsDocViaCheckout(t *testing.T) {
}

func TestDigitalOceanAsDocFromSHA(t *testing.T) {
requireNetworkTests(t)

data, _ := os.ReadFile("../../../test_specs/digitalocean.yaml")
info, _ := datamodel.ExtractSpecInfo(data)
var err error
Expand Down Expand Up @@ -569,6 +573,8 @@ func TestDigitalOceanAsDocFromSHA(t *testing.T) {
}

func TestDigitalOceanAsDocFromMain(t *testing.T) {
requireNetworkTests(t)

data, _ := os.ReadFile("../../../test_specs/digitalocean.yaml")
info, _ := datamodel.ExtractSpecInfo(data)
var err error
Expand Down
16 changes: 16 additions & 0 deletions datamodel/high/v3/network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package v3

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
16 changes: 16 additions & 0 deletions datamodel/low/v2/network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package v2

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
2 changes: 2 additions & 0 deletions datamodel/low/v2/swagger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ func TestRolodexLocalFileSystem_BadPath(t *testing.T) {
}

func TestRolodexRemoteFileSystem(t *testing.T) {
requireNetworkTests(t)

data, _ := os.ReadFile("../../../test_specs/first.yaml")
info, _ := datamodel.ExtractSpecInfo(data)

Expand Down
2 changes: 2 additions & 0 deletions datamodel/low/v3/create_document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ func TestRolodexLocalFileSystem_BadPath(t *testing.T) {
}

func TestRolodexRemoteFileSystem(t *testing.T) {
requireNetworkTests(t)

data, _ := os.ReadFile("../../../test_specs/first.yaml")
info, _ := datamodel.ExtractSpecInfo(data)

Expand Down
16 changes: 16 additions & 0 deletions datamodel/low/v3/network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package v3

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
1 change: 0 additions & 1 deletion document_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func ExampleNewDocument_fromWithDocumentConfigurationSuccess() {
// running this through a change detection, will render out the entire model and
// any stage two rendering for the model will be caught.
what_changed.CompareOpenAPIDocuments(m.Model.GoLow(), m.Model.GoLow())
// Output: Digital Ocean spec built successfully
}

func ExampleNewDocument_fromSwaggerDocument() {
Expand Down
4 changes: 4 additions & 0 deletions document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,8 @@ func TestDocument_TestNestedFiles(t *testing.T) {
}

func TestDocument_MinimalRemoteRefs(t *testing.T) {
requireNetworkTests(t)

newRemoteHandlerFunc := func() utils.RemoteURLHandler {
c := &http.Client{
Timeout: time.Second * 120,
Expand Down Expand Up @@ -1673,6 +1675,8 @@ func TestDocument_Issue264(t *testing.T) {
}

func TestDocument_Issue269(t *testing.T) {
requireNetworkTests(t)

spec := `openapi: "3.0.0"
info:
title: test
Expand Down
2 changes: 2 additions & 0 deletions index/find_component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func TestSpecIndex_FailFindComponentInRoot(t *testing.T) {
}

func TestSpecIndex_LocateRemoteDocsWithRemoteURLHandler(t *testing.T) {
requireNetworkTests(t)

// This test will push the index to do try and locate remote references that use relative references
spec := `openapi: 3.0.2
info:
Expand Down
16 changes: 16 additions & 0 deletions index/network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package index

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
4 changes: 4 additions & 0 deletions index/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,8 @@ func TestResolver_ExtractRelatives_HttpFullDefinition(t *testing.T) {
}

func TestResolver_ResolveComponents_MixedRef(t *testing.T) {
requireNetworkTests(t)

mixedref, _ := os.ReadFile("../test_specs/mixedref-burgershop.openapi.yaml")
var rootNode yaml.Node
_ = yaml.Unmarshal(mixedref, &rootNode)
Expand Down Expand Up @@ -1532,6 +1534,8 @@ func TestLocateRefEnd_WithResolve(t *testing.T) {
}

func TestResolveDoc_Issue195(t *testing.T) {
requireNetworkTests(t)

spec := `openapi: 3.0.1
info:
title: Some Example!
Expand Down
2 changes: 2 additions & 0 deletions index/rolodex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,8 @@ components:
}

func TestRolodex_IndexCircularLookup_LookupHttpNoBaseURL(t *testing.T) {
requireNetworkTests(t)

first := `openapi: 3.1.0
components:
schemas:
Expand Down
8 changes: 8 additions & 0 deletions index/spec_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ func TestSpecIndex_Asana(t *testing.T) {
}

func TestSpecIndex_DigitalOcean(t *testing.T) {
requireNetworkTests(t)

do, _ := os.ReadFile("../test_specs/digitalocean.yaml")
var rootNode yaml.Node
_ = yaml.Unmarshal(do, &rootNode)
Expand Down Expand Up @@ -241,6 +243,8 @@ func hasRateLimitedRemoteErrors(errs []error) bool {
}

func TestSpecIndex_Redocly(t *testing.T) {
requireNetworkTests(t)

do, _ := os.ReadFile("../test_specs/redocly-starter.yaml")
var rootNode yaml.Node
_ = yaml.Unmarshal(do, &rootNode)
Expand Down Expand Up @@ -303,6 +307,8 @@ func TestSpecIndex_Redocly(t *testing.T) {
}

func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve(t *testing.T) {
requireNetworkTests(t)

// this is a full checkout of the digitalocean API repo.
tmp := t.TempDir()
cmd := exec.Command("git", "clone", "https://github.com/digitalocean/openapi", tmp)
Expand Down Expand Up @@ -385,6 +391,8 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve(t *testing.T) {
}

func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve_RecursiveLookup(t *testing.T) {
requireNetworkTests(t)

// this is a full checkout of the digitalocean API repo.
tmp := t.TempDir()
cmd := exec.Command("git", "clone", "https://github.com/digitalocean/openapi", tmp)
Expand Down
16 changes: 16 additions & 0 deletions network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2026 HNO3Miracle
// SPDX-License-Identifier: MIT

package libopenapi

import (
"os"
"testing"
)

func requireNetworkTests(t *testing.T) {
t.Helper()
if os.Getenv("LIBOPENAPI_RUN_NETWORK_TESTS") == "" {
t.Skip("set LIBOPENAPI_RUN_NETWORK_TESTS to run tests requiring remote fixtures")
}
}
Loading