-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial test framework checkin * updated license * reorganized files updated docker file to new structure and statically compile * more file reorganization
- Loading branch information
Showing
7 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cucumber Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package common | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func Debug() { | ||
fmt.Println("able to reach glue code") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Copyright 2019 Comcast Cable Communications Management, LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
|
||
|
||
Feature: Hello World | ||
The user should see hello world | ||
|
||
@HelloWorld001 | ||
Scenario Outline: Verify the user sees "<Message>" | ||
When this test case is executed, the user should see "<Message>" | ||
Examples: | ||
| Message | | ||
| Hello World | | ||
| Hallo Welt | | ||
| Bonjour le monde | | ||
| こんにちは世界| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:alpine AS builder | ||
|
||
RUN apk update && apk add --no-cache git | ||
COPY ./codex-travis-testrunner /acceptance/src/codex-travis-testrunner | ||
COPY ./common /go/src/common | ||
WORKDIR /acceptance/src/codex-travis-testrunner | ||
|
||
RUN go get -d -v | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/codex-travis-testrunner | ||
|
||
|
||
FROM scratch | ||
COPY --from=builder /go/bin/codex-travis-testrunner /go/bin/codex-travis-testrunner | ||
COPY ./features/helloworld /features | ||
ENTRYPOINT ["/go/bin/codex-travis-testrunner","-feature=/features","-tags=HelloWorld001"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright 2019 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import "fmt" | ||
|
||
func HelloWorld001(msg string) error { | ||
|
||
fmt.Println(msg) | ||
|
||
return nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright 2019 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/gorilla/mux" | ||
) | ||
|
||
/* | ||
headers: | ||
content-length →21 | ||
content-type →application/json | ||
date →Tue, 15 Jan 2019 00:25:58 GMT | ||
x-tr1d1um-build →0.1.1-311 | ||
x-tr1d1um-flavor →cherry | ||
x-tr1d1um-region →ch2g | ||
x-tr1d1um-server →tr1d1um-cd-wgs.webpa.comcast.net | ||
x-tr1d1um-start-time →13 Dec 18 03:44 UTC | ||
message body: | ||
{ | ||
"message": "Success" | ||
} | ||
*/ | ||
|
||
func StartListener() { | ||
r := mux.NewRouter() | ||
// caducues-ct.xmidt.comcast.net:8090/api/v2/hook | ||
r.HandleFunc("/api/v2/hook", HandlePostRequest). | ||
Methods("POST") | ||
} | ||
|
||
//This will handle just webhook registration. It will validate the registration. | ||
func HandlePostRequest(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright 2019 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/Comcast/codex/tests/common" | ||
|
||
"github.com/DATA-DOG/godog" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Start Test Run") | ||
locationoffeaturefiles := flag.String("feature", "", "path to feature files") | ||
tags := flag.String("tags", "", "tags of testcases to be run") | ||
//for travis ci testing: | ||
//waitonlistener := flag.Bool("listenerfirst", false, "Start the listener first, then tests") | ||
flag.Parse() | ||
|
||
//wait for webhook registration | ||
|
||
//wait for api | ||
common.Debug() | ||
//run tests | ||
status := godog.RunWithOptions("godogs", func(s *godog.Suite) { | ||
FeatureContext(s) | ||
}, godog.Options{ | ||
Format: "progress", | ||
Paths: []string{*locationoffeaturefiles}, | ||
Tags: *tags, | ||
Concurrency: 1, | ||
NoColors: true, | ||
Output: os.Stdout, | ||
}) | ||
|
||
fmt.Println("Finish Test Run") | ||
os.Exit(status) | ||
} | ||
|
||
func FeatureContext(s *godog.Suite) { | ||
|
||
s.Step(`^this test case is executed, the user should see "([^"]*)"$`, HelloWorld001) | ||
|
||
} |