Skip to content

Commit

Permalink
extracted parts of pkg/gameservers that deal with SDK server into pkg…
Browse files Browse the repository at this point in the history
…/sdkserver
  • Loading branch information
jkowalski authored and markmandel committed Dec 21, 2018
1 parent d4b1d10 commit 0162947
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 24 deletions.
8 changes: 4 additions & 4 deletions cmd/sdk-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"agones.dev/agones/pkg"
"agones.dev/agones/pkg/client/clientset/versioned"
"agones.dev/agones/pkg/gameservers"
"agones.dev/agones/pkg/sdk"
"agones.dev/agones/pkg/sdkserver"
"agones.dev/agones/pkg/util/runtime"
"agones.dev/agones/pkg/util/signals"
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down Expand Up @@ -108,8 +108,8 @@ func main() {
logger.WithError(err).Fatalf("Could not create the agones api clientset")
}

var s *gameservers.SDKServer
s, err = gameservers.NewSDKServer(viper.GetString(gameServerNameEnv),
var s *sdkserver.SDKServer
s, err = sdkserver.NewSDKServer(viper.GetString(gameServerNameEnv),
viper.GetString(podNamespaceEnv), kubeClient, agonesClient)
if err != nil {
logger.WithError(err).Fatalf("Could not start sidecar")
Expand Down Expand Up @@ -146,7 +146,7 @@ func registerLocal(grpcServer *grpc.Server, ctlConf config) error {
}
}

local, err := gameservers.NewLocalSDKServer(filePath)
local, err := sdkserver.NewLocalSDKServer(filePath)
if err != nil {
return err
}
Expand Down
11 changes: 11 additions & 0 deletions pkg/gameservers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,3 +1106,14 @@ func newFakeController() (*Controller, agtesting.Mocks) {
c.recorder = m.FakeRecorder
return c, m
}

func newSingleContainerSpec() v1alpha1.GameServerSpec {
return v1alpha1.GameServerSpec{
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
},
},
}
}
15 changes: 1 addition & 14 deletions pkg/gameservers/helper_test.go → pkg/sdkserver/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"context"
Expand All @@ -22,27 +22,14 @@ import (
"testing"
"time"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
"agones.dev/agones/pkg/sdk"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
netcontext "golang.org/x/net/context"
"google.golang.org/grpc/metadata"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/wait"
)

func newSingleContainerSpec() v1alpha1.GameServerSpec {
return v1alpha1.GameServerSpec{
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
},
},
}
}

func testHTTPHealth(t *testing.T, url string, expectedResponse string, expectedStatus int) {
// do a poll, because this code could run before the health check becomes live
err := wait.PollImmediate(time.Second, 20*time.Second, func() (done bool, err error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/localsdk.go → pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/sdk.go → pkg/sdkserver/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"agones.dev/agones/pkg/apis/stable/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/sdk_test.go → pkg/sdkserver/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"net/http"
Expand Down

0 comments on commit 0162947

Please sign in to comment.