-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: restructuring inspector-driver integration
- Loading branch information
Showing
24 changed files
with
889 additions
and
362 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 |
---|---|---|
@@ -1,18 +1,32 @@ | ||
package driver | ||
|
||
// SystemInfo gives more insight into system details | ||
type SystemDetails struct { | ||
IsWindows bool | ||
IsLinux bool | ||
IsDarwin bool | ||
IsWeb bool | ||
Name string | ||
Extra string | ||
} | ||
|
||
type fields struct { | ||
// Supported inspector representations for specific driver | ||
Supported []string | ||
// Selected inspector representations | ||
Selected []string | ||
// Polling interval between retrievals | ||
PollInterval int64 | ||
Info *SystemDetails | ||
} | ||
|
||
// Command represents the two commands ReadFile & RunCommand | ||
type Command func(string) (string, error) | ||
|
||
// Driver : specification of functions to be defined by every Driver | ||
type Driver interface { | ||
ReadFile(path string) (string, error) | ||
RunCommand(command string) (string, error) | ||
// shows the driver details, not sure if we should be showing OS name | ||
GetDetails() string | ||
GetDetails() SystemDetails | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package driver | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func NewWebForTest() *Web { | ||
return &Web{ | ||
URL: "https://duckduckgo.com", | ||
Method: GET, | ||
fields: fields{ | ||
PollInterval: 5, | ||
}, | ||
} | ||
} | ||
|
||
func TestWebRunCommand(t *testing.T) { | ||
d := NewWebForTest() | ||
output, err := d.RunCommand(`response`) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
if output == "" { | ||
t.Error("Could not parse response time") | ||
} | ||
} | ||
|
||
func TestWebSystemDetails(t *testing.T) { | ||
d := NewWebForTest() | ||
details := d.GetDetails() | ||
if !details.IsWeb { | ||
t.Errorf("Expected web driver for web test got %s", details.Name) | ||
} | ||
} |
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
Oops, something went wrong.