Skip to content

Commit

Permalink
Merge pull request #308 from Kostov6/http_cache_test
Browse files Browse the repository at this point in the history
Http cache test and resource name bugfix
  • Loading branch information
Kostov6 authored Feb 8, 2024
2 parents 68aff7d + f60aace commit a748420
Show file tree
Hide file tree
Showing 22 changed files with 1,145 additions and 307 deletions.
2 changes: 1 addition & 1 deletion cmd/app/initilization.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func newRepositoryHost(host string, client *github.Client, httpClient *http.Clie
if host == "github.com" {
rawHost = "raw.githubusercontent.com"
}
return githubhttpcache.NewGHC(host, client, httpClient, &osshim.OsShim{}, []string{host, rawHost}, localMappings, options)
return githubhttpcache.NewGHC(host, client, client.Repositories, client.Git, httpClient, &osshim.OsShim{}, []string{host, rawHost}, localMappings, options)
}

// NewReactor creates a Reactor from Options
Expand Down
11 changes: 4 additions & 7 deletions pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,24 @@ func processManifest(f nodeTransformation, node *Node, parent *Node, manifest *N
}

func loadManifestStructure(node *Node, parent *Node, manifest *Node, r resourcehandlers.Registry) error {
var (
err error
content string
newManifest string
)
if node.Manifest == "" {
return nil
}
fs, err := r.Get(manifest.Manifest)
if err != nil {
return err
}
if newManifest, err = fs.ToAbsLink(manifest.Manifest, node.Manifest); err != nil {
newManifest, err := fs.ToAbsLink(manifest.Manifest, node.Manifest)
if err != nil {
return fmt.Errorf("can't build manifest node %s absolute URL : %w ", node.Manifest, err)
}
node.Manifest = newManifest
fs, err = r.Get(node.Manifest)
if err != nil {
return err
}
if content, err = fs.ManifestFromURL(node.Manifest); err != nil {
content, err := fs.ManifestFromURL(node.Manifest)
if err != nil {
return fmt.Errorf("can't get manifest file content : %w", err)
}
if err = yaml.Unmarshal([]byte(content), node); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/osfakes/httpclient/httpclientfakes/fake_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/osfakes/osshim/osshimfakes/fake_os.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions pkg/readers/link/resource_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package link
import (
"fmt"
"net/url"
"path"
"regexp"
)

Expand Down Expand Up @@ -100,13 +99,3 @@ func (r *Resource) GetRepoURL() string {
func (r *Resource) GetRawURL() string {
return fmt.Sprintf("https://%s/%s/%s/raw/%s/%s", r.Host, r.Owner, r.Repo, r.Ref, r.Path)
}

// GetResourceName returns the name of the resource (including extension), if resource path is empty returns '.'
func (r *Resource) GetResourceName() string {
return path.Base(r.Path)
}

// GetResourceExt returns the resource name extension, empty string if when no extension exists
func (r *Resource) GetResourceExt() string {
return path.Ext(r.Path)
}
Loading

0 comments on commit a748420

Please sign in to comment.