added new module
This commit is contained in:
@@ -3,7 +3,7 @@ package client
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/config"
|
||||
"github.com/google/uuid"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -16,7 +16,7 @@ type Groups struct {
|
||||
|
||||
// Group Information about a single group
|
||||
type Group struct {
|
||||
ID string `json:"ID"`
|
||||
ID string `json:"ID"`
|
||||
TrackContainerList []*TrackContainer `json:"TrackContainer"`
|
||||
// Sneaky as required only when removing the element
|
||||
// Set when GetGroup function is called
|
||||
@@ -24,7 +24,7 @@ type Group struct {
|
||||
}
|
||||
|
||||
// CreateGroup Creates a new group to add a set of track containers
|
||||
func CreateGroup() (*Group, error){
|
||||
func CreateGroup() (*Group, error) {
|
||||
// Creating variable of type new group
|
||||
var NewGroup Group
|
||||
// Generate new UUID for group ID
|
||||
@@ -40,7 +40,7 @@ func CreateGroup() (*Group, error){
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &NewGroup,nil
|
||||
return &NewGroup, nil
|
||||
}
|
||||
|
||||
// RemoveGroup Removes group based on the group ID provided
|
||||
@@ -57,7 +57,7 @@ func RemoveGroup(GroupID string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Remove Group struct from the groups variable
|
||||
// Remove Group struct from the groups variable
|
||||
groups.GroupList = append(groups.GroupList[:group.index], groups.GroupList[group.index+1:]...)
|
||||
|
||||
// Write new groups to the grouptrackcontainer json file
|
||||
@@ -89,7 +89,7 @@ func AddContainerToGroup(ContainerID string, GroupID string) (*Group, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Updating specific element in the group list with the added container
|
||||
// Updating specific element in the group list with the added container
|
||||
groups.GroupList[group.index] = group
|
||||
// Write groups information on the grouptrackcontainer.json file
|
||||
err = groups.WriteGroup()
|
||||
@@ -101,21 +101,21 @@ func AddContainerToGroup(ContainerID string, GroupID string) (*Group, error) {
|
||||
}
|
||||
|
||||
// RemoveContainerGroup Remove Container from the group ID specified
|
||||
func RemoveContainerGroup(ContainerID string, GroupID string) (*Group,error) {
|
||||
func RemoveContainerGroup(ContainerID string, GroupID string) (*Group, error) {
|
||||
// Get container information based on container ID provided
|
||||
containerInfo, err := GetContainerInformation(ContainerID)
|
||||
if err != nil {
|
||||
return nil,err
|
||||
return nil, err
|
||||
}
|
||||
// Gets group information based on the group ID provided
|
||||
group, err := GetGroup(GroupID)
|
||||
if err != nil {
|
||||
return nil,err
|
||||
return nil, err
|
||||
}
|
||||
// Remove container from the appropriate group
|
||||
err = group.RemoveContainerGroup(containerInfo)
|
||||
if err != nil {
|
||||
return nil,err
|
||||
return nil, err
|
||||
}
|
||||
// Get Groups information from reading the grouptrackcontainer.json file
|
||||
groups, err := ReadGroup()
|
||||
@@ -163,7 +163,7 @@ func RemoveContainerGroups(ContainerID string) error {
|
||||
|
||||
// GetGroup Gets group information based on
|
||||
// group id provided
|
||||
func GetGroup(GroupID string) (*Group,error) {
|
||||
func GetGroup(GroupID string) (*Group, error) {
|
||||
// Read group information from the
|
||||
//grouptrackcontainer json file
|
||||
groups, err := ReadGroup()
|
||||
@@ -179,16 +179,16 @@ func GetGroup(GroupID string) (*Group,error) {
|
||||
}
|
||||
}
|
||||
|
||||
return nil,errors.New("Group not found. ")
|
||||
return nil, errors.New("Group not found. ")
|
||||
}
|
||||
|
||||
// AddGroupToFile Adds Group struct to the GroupTrackContainer File
|
||||
func (grp *Group) AddGroupToFile() error {
|
||||
// Gets all group information from the
|
||||
// GroupTrackContainer JSON file
|
||||
groups, err := ReadGroup()
|
||||
if err != nil {
|
||||
return err
|
||||
groups, err := ReadGroup()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Appending the newly created group
|
||||
groups.GroupList = append(groups.GroupList, grp)
|
||||
@@ -204,16 +204,16 @@ func (grp *Group) AddGroupToFile() error {
|
||||
|
||||
// ReadGroup Function reads grouptrackcontainers.json and converts
|
||||
// result to Groups
|
||||
func ReadGroup() (*Groups,error) {
|
||||
func ReadGroup() (*Groups, error) {
|
||||
// Get Path from config
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return nil,err
|
||||
return nil, err
|
||||
}
|
||||
jsonFile, err := os.Open(config.GroupTrackContainersPath)
|
||||
// if we os.Open returns an error then handle it
|
||||
if err != nil {
|
||||
return nil,err
|
||||
return nil, err
|
||||
}
|
||||
// defer the closing of our jsonFile so that we can parse it later on
|
||||
defer jsonFile.Close()
|
||||
@@ -227,9 +227,8 @@ func ReadGroup() (*Groups,error) {
|
||||
return &groups, nil
|
||||
}
|
||||
|
||||
|
||||
// WriteGroup Function to write type Groups to the grouptrackcontainers.json file
|
||||
func (grp *Groups)WriteGroup() error {
|
||||
func (grp *Groups) WriteGroup() error {
|
||||
file, err := json.MarshalIndent(grp, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -239,7 +238,7 @@ func (grp *Groups)WriteGroup() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Writes to the appropriate file
|
||||
// Writes to the appropriate file
|
||||
err = ioutil.WriteFile(config.GroupTrackContainersPath, file, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -248,13 +247,13 @@ func (grp *Groups)WriteGroup() error {
|
||||
}
|
||||
|
||||
// AddContainer Adds a container to the Tracked container list of the group
|
||||
func (grp *Group)AddContainer(Container *TrackContainer) error {
|
||||
func (grp *Group) AddContainer(Container *TrackContainer) error {
|
||||
grp.TrackContainerList = append(grp.TrackContainerList, Container)
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveContainerGroup Removes container information from the group
|
||||
func (grp *Group)RemoveContainerGroup(Container *TrackContainer) error {
|
||||
func (grp *Group) RemoveContainerGroup(Container *TrackContainer) error {
|
||||
// Iterating through all container in the Group of Tracked Container
|
||||
for i, container := range grp.TrackContainerList {
|
||||
// If the container ID matches then remove the container from the group
|
||||
@@ -266,9 +265,9 @@ func (grp *Group)RemoveContainerGroup(Container *TrackContainer) error {
|
||||
}
|
||||
|
||||
// RemoveContainerGroups removes container found in all groups
|
||||
func (grp *Groups)RemoveContainerGroups(Container *TrackContainer) error {
|
||||
func (grp *Groups) RemoveContainerGroups(Container *TrackContainer) error {
|
||||
// Iterating through all groups
|
||||
for i,group := range grp.GroupList {
|
||||
for i, group := range grp.GroupList {
|
||||
// Removes the container in the following group
|
||||
// if it exists
|
||||
err := group.RemoveContainerGroup(Container)
|
||||
@@ -283,7 +282,7 @@ func (grp *Groups)RemoveContainerGroups(Container *TrackContainer) error {
|
||||
|
||||
// ModifyContainerGroups Modifies container information is all groups
|
||||
// available
|
||||
func (TC *TrackContainer)ModifyContainerGroups() error {
|
||||
func (TC *TrackContainer) ModifyContainerGroups() error {
|
||||
group, err := ReadGroup()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -293,7 +292,7 @@ func (TC *TrackContainer)ModifyContainerGroups() error {
|
||||
// ID matches
|
||||
for i, _ := range group.GroupList {
|
||||
// Checking in each group if the modified container ID exists
|
||||
for j, _:= range group.GroupList[i].TrackContainerList {
|
||||
for j, _ := range group.GroupList[i].TrackContainerList {
|
||||
// If there is match then change them
|
||||
if group.GroupList[i].TrackContainerList[j].Id == TC.Id {
|
||||
group.GroupList[i].TrackContainerList[j] = TC
|
||||
@@ -308,4 +307,4 @@ func (TC *TrackContainer)ModifyContainerGroups() error {
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server/docker"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server/docker"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -46,14 +46,14 @@ func TestAddContainerToGroup(t *testing.T) {
|
||||
|
||||
// Creating and adding the container to the
|
||||
// tracked list
|
||||
container1 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container1, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
// Testing the AddTrackContainer Function and adding the first container created
|
||||
err = AddTrackContainer(container1,"0.0.0.0")
|
||||
err = AddTrackContainer(container1, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
@@ -66,7 +66,7 @@ func TestAddContainerToGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
// Adds container information to the group
|
||||
Group, err := AddContainerToGroup(container1.ID,group.ID)
|
||||
Group, err := AddContainerToGroup(container1.ID, group.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
@@ -109,14 +109,14 @@ func TestGroup_RemoveContainerGroup(t *testing.T) {
|
||||
|
||||
// Creating and adding the container to the
|
||||
// tracked list
|
||||
container1 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container1, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
// Testing the AddTrackContainer Function and adding the first container created
|
||||
err = AddTrackContainer(container1,"0.0.0.0")
|
||||
err = AddTrackContainer(container1, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
@@ -129,7 +129,7 @@ func TestGroup_RemoveContainerGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
// Adds container information to the group
|
||||
Group, err := AddContainerToGroup(container1.ID,group.ID)
|
||||
Group, err := AddContainerToGroup(container1.ID, group.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
@@ -138,7 +138,7 @@ func TestGroup_RemoveContainerGroup(t *testing.T) {
|
||||
PrettyPrint(Group)
|
||||
|
||||
// Removing docker container from the group
|
||||
Group, err = RemoveContainerGroup(container1.ID,group.ID)
|
||||
Group, err = RemoveContainerGroup(container1.ID, group.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
@@ -182,7 +182,7 @@ func TestGroups_RemoveContainerGroups(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
// Created another group assigned to variable group 1
|
||||
// Created another group assigned to variable group 1
|
||||
group1, err := CreateGroup()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
@@ -191,14 +191,14 @@ func TestGroups_RemoveContainerGroups(t *testing.T) {
|
||||
|
||||
// Creating and adding the container to the
|
||||
// tracked list
|
||||
container1 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container1, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
// Testing the AddTrackContainer Function and adding the first container created
|
||||
err = AddTrackContainer(container1,"0.0.0.0")
|
||||
err = AddTrackContainer(container1, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
@@ -211,7 +211,7 @@ func TestGroups_RemoveContainerGroups(t *testing.T) {
|
||||
}
|
||||
|
||||
// Adds container information to the group
|
||||
Group, err := AddContainerToGroup(container1.ID,group.ID)
|
||||
Group, err := AddContainerToGroup(container1.ID, group.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
@@ -220,7 +220,7 @@ func TestGroups_RemoveContainerGroups(t *testing.T) {
|
||||
PrettyPrint(Group)
|
||||
|
||||
// Adds container information to the group
|
||||
Group1, err := AddContainerToGroup(container1.ID,group1.ID)
|
||||
Group1, err := AddContainerToGroup(container1.ID, group1.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
|
||||
@@ -3,7 +3,7 @@ package client
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -4,38 +4,38 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server/docker"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/config"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server/docker"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
// TrackContainers This struct stores arrays of current containers running
|
||||
type TrackContainers struct {
|
||||
TrackContainerList []TrackContainer `json:"TrackContainer"`
|
||||
TrackContainerList []TrackContainer `json:"TrackContainer"`
|
||||
}
|
||||
|
||||
// TrackContainer Stores information of current containers
|
||||
type TrackContainer struct {
|
||||
Id string `json:"ID"`
|
||||
Container *docker.DockerVM `json:"Container"`
|
||||
IpAddress string `json:"IpAddress"`
|
||||
Id string `json:"ID"`
|
||||
Container *docker.DockerVM `json:"Container"`
|
||||
IpAddress string `json:"IpAddress"`
|
||||
}
|
||||
|
||||
// AddTrackContainer Adds new container which has been added to the track container
|
||||
func AddTrackContainer(d *docker.DockerVM,ipAddress string) error {
|
||||
func AddTrackContainer(d *docker.DockerVM, ipAddress string) error {
|
||||
// Checking if pointer d is null
|
||||
if d == nil {
|
||||
return errors.New("d is nil")
|
||||
}
|
||||
//Get config information to derive paths for track containers json file
|
||||
config,err := config.ConfigInit()
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Getting information about the file trackcontainers.json file
|
||||
stat, err := os.Stat(config.TrackContainersPath)
|
||||
// Getting information about the file trackcontainers.json file
|
||||
stat, err := os.Stat(config.TrackContainersPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -66,11 +66,11 @@ func AddTrackContainer(d *docker.DockerVM,ipAddress string) error {
|
||||
trackContainers.TrackContainerList = append(trackContainers.TrackContainerList, trackContainer)
|
||||
|
||||
// write modified information to the tracked json file
|
||||
data,err := json.MarshalIndent(trackContainers, "", "\t")
|
||||
data, err := json.MarshalIndent(trackContainers, "", "\t")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(config.TrackContainersPath,data,0777)
|
||||
err = ioutil.WriteFile(config.TrackContainersPath, data, 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -81,7 +81,7 @@ func AddTrackContainer(d *docker.DockerVM,ipAddress string) error {
|
||||
// RemoveTrackedContainer This function removos tracked container from the trackcontainer JSON file
|
||||
func RemoveTrackedContainer(id string) error {
|
||||
//Get config information to derive paths for track containers json file
|
||||
config,err := config.ConfigInit()
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -104,11 +104,11 @@ func RemoveTrackedContainer(id string) error {
|
||||
trackedContainers.TrackContainerList = append(trackedContainers.TrackContainerList[:removeElement], trackedContainers.TrackContainerList[removeElement+1:]...)
|
||||
|
||||
// write modified information to the tracked json file
|
||||
data,err := json.MarshalIndent(trackedContainers, "", "\t")
|
||||
data, err := json.MarshalIndent(trackedContainers, "", "\t")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(config.TrackContainersPath,data,0777)
|
||||
err = ioutil.WriteFile(config.TrackContainersPath, data, 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -117,17 +117,17 @@ func RemoveTrackedContainer(id string) error {
|
||||
}
|
||||
|
||||
// ViewTrackedContainers View Containers currently tracked
|
||||
func ViewTrackedContainers() (error,*TrackContainers) {
|
||||
config,err := config.ConfigInit()
|
||||
func ViewTrackedContainers() (error, *TrackContainers) {
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return err,nil
|
||||
return err, nil
|
||||
}
|
||||
trackedContianers, err := ReadTrackContainers(config.TrackContainersPath)
|
||||
if err != nil {
|
||||
return err,nil
|
||||
return err, nil
|
||||
}
|
||||
|
||||
return nil,trackedContianers
|
||||
return nil, trackedContianers
|
||||
}
|
||||
|
||||
// ReadTrackContainers Reads containers which are currently tracked
|
||||
@@ -167,7 +167,7 @@ func GetContainerInformation(ID string) (*TrackContainer, error) {
|
||||
}
|
||||
|
||||
// ModifyContainerInformation Modifies information inside the container
|
||||
func (TC *TrackContainer)ModifyContainerInformation() error {
|
||||
func (TC *TrackContainer) ModifyContainerInformation() error {
|
||||
// Gets all the information of tracker containers
|
||||
err, t := ViewTrackedContainers()
|
||||
if err != nil {
|
||||
@@ -192,15 +192,15 @@ func (TC *TrackContainer)ModifyContainerInformation() error {
|
||||
}
|
||||
|
||||
// WriteContainers Write information back to the config file
|
||||
func (TC *TrackContainers)WriteContainers() error {
|
||||
func (TC *TrackContainers) WriteContainers() error {
|
||||
// Initialize config file
|
||||
config,err := config.ConfigInit()
|
||||
config, err := config.ConfigInit()
|
||||
// write modified information to the tracked json file
|
||||
data,err := json.MarshalIndent(TC, "", "\t")
|
||||
data, err := json.MarshalIndent(TC, "", "\t")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(config.TrackContainersPath,data,0777)
|
||||
err = ioutil.WriteFile(config.TrackContainersPath, data, 0777)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -209,12 +209,12 @@ func (TC *TrackContainers)WriteContainers() error {
|
||||
}
|
||||
|
||||
// CheckID Checks if the ID belongs to a group or a single container
|
||||
func CheckID(ID string) (string,error) {
|
||||
// For group checks if the 1st characters is "grp"
|
||||
func CheckID(ID string) (string, error) {
|
||||
// For group checks if the 1st characters is "grp"
|
||||
if ID[0:3] == "grp" {
|
||||
return "group", nil
|
||||
} else {
|
||||
return "container", nil
|
||||
}
|
||||
return "",nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@ package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server/docker"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server/docker"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Tests a scenario where the container are getting tracked
|
||||
func TestAddTrackContainer(t *testing.T) {
|
||||
// Create docker container and get SSH port
|
||||
container1 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container1, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
// Testing the AddTrackContainer Function
|
||||
err = AddTrackContainer(container1,"0.0.0.0")
|
||||
err = AddTrackContainer(container1, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
@@ -26,7 +26,7 @@ func TestAddTrackContainer(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
// Killing docker container created
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
@@ -38,20 +38,20 @@ func TestAddTrackContainer(t *testing.T) {
|
||||
// NOTE: This test can also be considered as a whole flow on the process of
|
||||
// tracked containers
|
||||
func TestRemoveTrackedContainer(t *testing.T) {
|
||||
container1 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container1, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
container2 ,err := docker.BuildRunContainer(0,"false","")
|
||||
container2, err := docker.BuildRunContainer(0, "false", "")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
// Testing the AddTrackContainer Function and adding the first container created
|
||||
err = AddTrackContainer(container1,"0.0.0.0")
|
||||
err = AddTrackContainer(container1, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container1.ID)
|
||||
@@ -70,7 +70,7 @@ func TestRemoveTrackedContainer(t *testing.T) {
|
||||
}
|
||||
|
||||
// Testing the AddTrackContainer Function and the adding the second container created
|
||||
err = AddTrackContainer(container2,"0.0.0.0")
|
||||
err = AddTrackContainer(container2, "0.0.0.0")
|
||||
if err != nil {
|
||||
// Killing docker container created
|
||||
err = docker.StopAndRemoveContainer(container2.ID)
|
||||
@@ -106,7 +106,7 @@ func TestRemoveTrackedContainer(t *testing.T) {
|
||||
// Test function that checks if the ID belongs to
|
||||
// a group or container running
|
||||
func TestCheckID(t *testing.T) {
|
||||
id := "grp123"
|
||||
id := "grp123"
|
||||
checkID, err := CheckID(id)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
@@ -3,8 +3,8 @@ package clientIPTable
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/p2p"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/config"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/p2p"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
|
||||
@@ -3,8 +3,8 @@ package client
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/p2p"
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/server/docker"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/p2p"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server/docker"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
Reference in New Issue
Block a user