ALL SORTS OF THINGS

This commit is contained in:
2025-04-21 23:04:24 -04:00
parent b79b34e8cc
commit 92d4be2f23
3 changed files with 9 additions and 8 deletions

View File

@@ -1,13 +1,12 @@
stages:
- noop
- Testing
- build
noop:
stage: noop
script:
- echo "This is a no-op job"
include:
- component: $CI_SERVER_FQDN/shared/blueprints/golang-tests@v1.2.0
rules:
- if: '$CI_COMMIT_BRANCH'
- component: $CI_SERVER_FQDN/shared/blueprints/docker-build@v1.2.0
rules:
- if: '$CI_COMMIT_TAG'

View File

@@ -22,7 +22,9 @@ func Get(c echo.Context) error {
if err != nil || latestImageVal == "" {
c.Logger().Info("Fetching latest image")
latestImageVal, err = client.GetLatestImage()
latestImageVal, err = client.GetLatestImage(func(url string) (*http.Response, error) {
return http.Get(url)
})
if err != nil {
return c.String(http.StatusInternalServerError, "Error fetching latest image")
}

View File

@@ -54,9 +54,9 @@ type redditResponse struct {
} `json:"data"`
}
func GetLatestImage() (string, error) {
func GetLatestImage(httpGet func(url string) (*http.Response, error)) (string, error) {
response, err := http.Get("https://www.reddit.com/r/wallpaper/.json")
response, err := httpGet("https://www.reddit.com/r/wallpaper/.json")
if err != nil {
return "", err
}