Skip to content

Instantly share code, notes, and snippets.

🐯
Focusing

Praveen Shukla achilles42

🐯
Focusing
Block or report user

Report or block achilles42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@achilles42
achilles42 / goreleaser.sh
Created Sep 28, 2018
goreleaser for proctor
View goreleaser.sh
#!/bin/sh
set -e
TAR_FILE="/tmp/goreleaser.tar.gz"
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases"
TMP_DIR="/tmp/"
last_version() {
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
rev |
View nginx.conf
## start server foobar.mydomain.com
server {
server_name foobar.mydomain.com ;
listen 80;
listen [::]:80;
set $proxy_upstream_name "-";
location / {
log_by_lua_block {
}
port_in_redirect off;
View ingress.yml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: foobar
namespace: default
spec:
rules:
- host: foobar.mydomain.com
View values.yml
controller:
ingressClass: nginx
service:
annotations:
cloud.google.com/load-balancer-type: Internal
View Test-Driven-Infrastructure-with-chef.md

Traditionally, most of infrastructure is managed manually or by using scripts. This inconsistency causes many issues in infrastructure. TDD is known for increasing code quality, improving overall design, and allowing safe refactoring throughout a project. Explaining about how, why and which tools we should use to test code. So, I am going to explain about the how and why we should test our code and what are tools are available to test our infrastructure code.

Before Getting into actual usage of tool we should understand the phases of

  1. Pre-convergence: Testing phase that does not require any node to run the test.
  2. Convergence: Chef runs and make changes to the system on node.
  3. Post-convergence: Node finishes running Chef, also verifying that node is in the desired state.
View google_client.gemspec
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'google_client/version'
Gem::Specification.new do |spec|
spec.name = "google-client"
spec.version = GapiClient::VERSION
spec.authors = ["praveen shukla"]
spec.email = ["praveen.shukla@c42.in"]
View object_composotion.go
package main
import "fmt"
type Rectangle struct {
length, width int
}
func (r *Rectangle) Area() int {
return r.length * r.width
View polymorphism.go
package main
import "fmt"
type Shaper interface {
Area() int
}
type Rectangle struct {
length, width int
View encapsulation.go
package main
import "fmt"
type Rectangle struct {
length, width int
}
func (r *Rectangle) Area() int {
return r.length * r.width
You can’t perform that action at this time.