-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OSSM-5382: Fixing the BI test case (#648)
* updating the html file * removed unnessary space * updating the dynamic value in the HTML * creating the common file * Adding the TestreviewV3 parameter * updated the root path * updated the file var --------- Co-authored-by: Praneeth Bajjuri <pbajjuri@pbajjuri-thinkpadp1gen4i.rmtustx.csb>
- Loading branch information
1 parent
bcb0b8c
commit a9b054f
Showing
11 changed files
with
131 additions
and
16 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
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,63 @@ | ||
package traffic | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/maistra/maistra-test-tool/pkg/util/env" | ||
"github.com/maistra/maistra-test-tool/pkg/util/oc" | ||
"github.com/maistra/maistra-test-tool/pkg/util/pod" | ||
"github.com/maistra/maistra-test-tool/pkg/util/template" | ||
|
||
. "github.com/maistra/maistra-test-tool/pkg/util/test" | ||
) | ||
|
||
func TestreviewV1(t TestHelper, file string) string { | ||
|
||
ns := "bookinfo" | ||
|
||
reviewV1Podname := pod.MatchingSelector("app=reviews,version=v1", ns)(t, oc.DefaultOC).Name | ||
|
||
templateString, err := os.ReadFile(env.GetRootDir() + "/testdata/resources/html/" + file) | ||
if err != nil { | ||
t.Fatalf("could not read template file %s: %v", file, err) | ||
} | ||
htmlFile := template.Run(t, string(templateString), struct{ ReviewV1Podname string }{ReviewV1Podname: reviewV1Podname}) | ||
fmt.Println(htmlFile) | ||
os.WriteFile(env.GetRootDir()+"/testdata/resources/html/modified-"+file, []byte(htmlFile), 0644) | ||
|
||
return "modified-" + file | ||
|
||
} | ||
|
||
func TestreviewV2(t TestHelper, file string) string { | ||
|
||
ns := "bookinfo" | ||
|
||
reviewV2Podname := pod.MatchingSelector("app=reviews,version=v2", ns)(t, oc.DefaultOC).Name | ||
template2String, err := os.ReadFile(env.GetRootDir() + "/testdata/resources/html/" + file) | ||
if err != nil { | ||
t.Fatalf("could not read template file %s: %v", file, err) | ||
} | ||
html2File := template.Run(t, string(template2String), struct{ ReviewV2Podname string }{ReviewV2Podname: reviewV2Podname}) | ||
os.WriteFile(env.GetRootDir()+"/testdata/resources/html/modified-"+file, []byte(html2File), 0644) | ||
|
||
return "modified-" + file | ||
|
||
} | ||
|
||
func TestreviewV3(t TestHelper, file string) string { | ||
|
||
ns := "bookinfo" | ||
|
||
reviewV3Podname := pod.MatchingSelector("app=reviews,version=v3", ns)(t, oc.DefaultOC).Name | ||
template3String, err := os.ReadFile(env.GetRootDir() + "/testdata/resources/html/" + file) | ||
if err != nil { | ||
t.Fatalf("could not read template file %s: %v", file, err) | ||
} | ||
html2File := template.Run(t, string(template3String), struct{ ReviewV3Podname string }{ReviewV3Podname: reviewV3Podname}) | ||
os.WriteFile(env.GetRootDir()+"/testdata/resources/html/modified-"+file, []byte(html2File), 0644) | ||
|
||
return "modified-" + file | ||
|
||
} |
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
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
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
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
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
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
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
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
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