mirror of https://github.com/docker/docs.git
exclude archives when testing urls for now
Signed-off-by: Adrien Duermael <adrien@duermael.com>
This commit is contained in:
parent
09d4a6f832
commit
4cbff2cb39
|
@ -7,6 +7,7 @@ import (
|
|||
"golang.org/x/net/html"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
@ -23,6 +24,16 @@ func TestURLs(t *testing.T) {
|
|||
|
||||
relPath := strings.TrimPrefix(path, "/usr/src/app/allvbuild")
|
||||
|
||||
isArchive, err := regexp.MatchString(`^/v[0-9]+\.[0-9]+/.*`, relPath)
|
||||
if err != nil {
|
||||
t.Error(err.Error(), "-", relPath)
|
||||
}
|
||||
// skip archives for now, only test URLs in current version
|
||||
// TODO: test archives
|
||||
if isArchive {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Error(err.Error(), "-", relPath)
|
||||
}
|
||||
|
@ -44,9 +55,9 @@ func TestURLs(t *testing.T) {
|
|||
return nil
|
||||
})
|
||||
|
||||
fmt.Println("found", count, "html files")
|
||||
fmt.Println("found", countLinks, "links")
|
||||
fmt.Println("found", countImages, "images")
|
||||
fmt.Println("found", count, "html files (excluding archives)")
|
||||
fmt.Println("found", countLinks, "links (excluding archives)")
|
||||
fmt.Println("found", countImages, "images (excluding archives)")
|
||||
}
|
||||
|
||||
// testURLs tests if we're not using absolute paths for URLs
|
||||
|
|
Loading…
Reference in New Issue