Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the parameter order #118

Merged
merged 1 commit into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func CheckPodParameter(sp *serviceprovider.Container, pod *entity.Pod) error {
return nil
}

func generateVolume(pod *entity.Pod, session *mongo.Session) ([]corev1.Volume, []corev1.VolumeMount, error) {
func generateVolume(session *mongo.Session, pod *entity.Pod) ([]corev1.Volume, []corev1.VolumeMount, error) {
volumes := []corev1.Volume{}
volumeMounts := []corev1.VolumeMount{}

Expand Down Expand Up @@ -167,7 +167,7 @@ func generateInitContainer(networks []entity.PodNetwork) ([]corev1.Container, er
//For the network, we will generate two things
//[]string => a list of nodes and it will apply on nodeaffinity
//[]corev1.Container => a list of init container we will apply on pod
func generateNetwork(pod *entity.Pod, session *mongo.Session) ([]string, []corev1.Container, error) {
func generateNetwork(session *mongo.Session, pod *entity.Pod) ([]string, []corev1.Container, error) {

networks := []entity.Network{}
containers := []corev1.Container{}
Expand Down Expand Up @@ -212,12 +212,12 @@ func CreatePod(sp *serviceprovider.Container, pod *entity.Pod) error {
session := sp.Mongo.NewSession()
defer session.Close()

volumes, volumeMounts, err := generateVolume(pod, session)
volumes, volumeMounts, err := generateVolume(session, pod)
if err != nil {
return err
}

nodeNames, initContainers, err := generateNetwork(pod, session)
nodeNames, initContainers, err := generateNetwork(session, pod)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions src/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (suite *PodTestSuite) TestGenerateVolume() {
session.Insert(entity.VolumeCollectionName, volume)
defer session.Remove(entity.VolumeCollectionName, "name", volume.Name)

volumes, volumeMounts, err := generateVolume(pod, session)
volumes, volumeMounts, err := generateVolume(session, pod)
suite.NotNil(volumes)
suite.NotNil(volumeMounts)
suite.NoError(err)
Expand All @@ -153,7 +153,7 @@ func (suite *PodTestSuite) TestGenerateVolumeFail() {

session := suite.sp.Mongo.NewSession()
defer session.Close()
volumes, volumeMounts, err := generateVolume(pod, session)
volumes, volumeMounts, err := generateVolume(session, pod)
suite.Nil(volumes)
suite.Nil(volumeMounts)
suite.Error(err)
Expand Down Expand Up @@ -307,7 +307,7 @@ func (suite *PodTestSuite) TestGenerateNetwork() {
},
}

nodes, containers, err := generateNetwork(pod, session)
nodes, containers, err := generateNetwork(session, pod)
suite.NoError(err)
suite.Equal(1, len(containers))
suite.Equal(0, len(nodes))
Expand All @@ -333,7 +333,7 @@ func (suite *PodTestSuite) TestGenerateNetworkFail() {
session := suite.sp.Mongo.NewSession()
defer session.Close()

nodes, containers, err := generateNetwork(pod, session)
nodes, containers, err := generateNetwork(session, pod)
suite.Error(err)
suite.Nil(nodes)
suite.Nil(containers)
Expand Down