Skip to content

Instantly share code, notes, and snippets.

View akantsevoi's full-sized avatar

Aliaksandr Kantsevoi akantsevoi

  • Sweden
View GitHub Profile
func heightForModel(dataModel: DataModel) -> CGFloat {
let stringHeight = calculateHeightForText(dataModel.text)
  let commentsHeight = dataModel.comments.count > 0 ? Constant.commentsPanelHeight : 0
return Constats.topPadding + Constants.titleHeight + stringHeight + commentsHeight
}
#!/bin/bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
xcode-select --install
brew install cask
brew install git-lfs
brew install ffmpeg
brew install imagemagick
type Server struct {
Router *httprouter.Router
storage database.Storage
}
router.GET("/read", s.read)
router.POST("/write", s.write)
func Test(t *testing.T) {
response := struct {
Success string `json:"success"`
}{}
requestHelper(
t,
"POST",
"/write",
strings.NewReader(`{"message":"text"}`),
&response,
#!/bin/sh
if [[ -z "$1" || -z "$2" ]]; then
{ echo "empty parameters $1 - MYSQL_HOST $2 - after run script"; exit 1; }
fi
MYSQL_HOST=$1
SECONDS_CHECK=40
echo "Check db: $MYSQL_HOST"
#!/bin/sh
RESULT=$(CGO_ENABLED=0 go test ./cmd/integrationtests -count=1 2> /dev/null)
if [ $? -ne 0 ]; then
echo "Test errors: $RESULT" >&2
exit 1
else
echo "Test success: $RESULT"
fi
ARG GO_VERSION=1.13.4
FROM golang:${GO_VERSION}-alpine
RUN apk add --no-cache ca-certificates git
RUN apk add mysql mysql-client
WORKDIR /main
COPY go.mod go.sum ./
version: '3.7'
networks:
integration-tests:
driver: bridge
services:
app:
build:
context: .
dockerfile: Dockerfile.test
#!/bin/bash
docker-compose -f docker-compose-tests.yml up --build --abort-on-container-exit --exit-code-from app 2> /dev/null
if [ $? -eq 0 ]
then
docker-compose -f docker-compose-tests.yml down --volumes
echo "Application tests success"
else
docker-compose -f docker-compose-tests.yml down --volumes